# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222350 | lyc | ACM (COCI19_acm) | C++14 | 8 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x).size()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i, a, b) for (int i=a;i>=b;--i)
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M; cin >> N >> M;
cin.ignore();
vector<tuple<int,int,string>> teams;
FOR(i,1,N){
string line; getline(cin, line);
istringstream tok(line);
string T; tok >> T;
string task;
int solved = 0, ptime = 0;
while (tok >> task) {
if (task[0] == '-') continue;
++solved;
ptime = (task[1]-'1') * 20 * 60;
//cout << "T " << T << " TASK " << task << endl;
int hh = stoi(task.substr(3,2)), mm = stoi(task.substr(6,2)), ss = stoi(task.substr(9,2));
ptime += hh * 60 * 60 + mm * 60 + ss;
}
teams.emplace_back(-solved,ptime,T);
}
string line; getline(cin, line);
istringstream tok(line);
string T; tok >> T;
string task;
int solved = 0, ptime = 0;
while (tok >> task) {
if (task[0] == '-') continue;
++solved;
ptime = (task[1]-'1') * 20 * 60;
int hh = stoi(task.substr(3,2)), mm = stoi(task.substr(6,2)), ss = stoi(task.substr(9,2));
ptime += hh * 60 * 60 + mm * 60 + ss;
}
for (auto& x : teams) {
if (get<2>(x) == T) {
x = make_tuple(-solved,ptime,T);
break;
}
}
//for(auto&x :teams){
// cout << get<2>(x) << " :: " << get<0>(x) << " " << get<1>(x) << endl;
//}
sort(teams.begin(),teams.end());
FOR(i,0,SZ(teams)-1){
if (get<2>(teams[i]) == T) {
cout << i+1;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |