#include <string>
#include <vector>
#include <map>
using namespace std;
int solution(vector<string> lines) {
int answer = 0;
//응답 시작시간, 끝시간
vector<pair<double, double>> v;
map<double, int> m;
for(auto a:lines) {
//s: a의 시간부터 초단위까지 substr
string s = a.substr(11, 12);
//처리시간 : 시, 분, 초
double d_tmp = stod(s.substr(0, 2))*3600 + stod(s.substr(3, 2)) * 60 + stod(s.substr(6, 2));
//소수점 초
double d_tmp2 = stod(s.substr(9, 3))/1000;
double d = d_tmp + d_tmp2;
string s2 = a.substr(24);
double d2 = stod(s2.substr(0, s2.length()-1));
double d3 = d - d2 + 0.001;
v.push_back(make_pair(d3,d));
//시작시간과 종료시간을 push
// for(int i=0; i<d2+d_tmp2; i++) {
// if(m.count(d_tmp+i) == 0) {
// m.insert(make_pair(d_tmp+i, 1));
// }
// else {
// m[d_tmp+i]++;
// }
// }
}
for(int i=0; i<v.size(); i++) {
double start = v[i].first;
double end = v[i].second;
int tmp = 1;
for(int j = i + 1; j < v.size(); j++) {
//기준점의 start+1범위내에서 시작하는 경우
//기준점의 end+1 내에서 시작하는 경우
if(start+1 >= v[j].first || end+1 > v[j].first) {
tmp++;
}
}
answer = tmp > answer? tmp : answer;
}
// map<double, int >::iterator iter;
// for(iter=m.begin(); iter!=m.end(); iter++) {
// if(answer < iter->second)
// answer = iter->second;
// }
return answer;
}
문제 이해하는게 더어려움