# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711635 | Luicosas | ACM (COCI19_acm) | C++17 | 3 ms | 340 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;
typedef long long ll;
#define pb push_back
#define sz(x) (int)(x.size())
#define itr(x) x.begin(), x.end()
#define prv(x) for(auto& i : x) cout << i << " "; cout << "\n";
#define debug(...) cerr << #__VA_ARGS__ << " : "; for(auto& i : {__VA_ARGS__}) cerr << i << " "; cerr << "\n";
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, t;
cin >> n >> t;
vector<string> names(n + 1);
vector<array<int,3>> pT(n + 1);
for(int i = 0; i < n + 1; i++) {
cin >> names[i];
pT[i][2] = i;
int solves = 0, times = 0;
for(int ii = 0; ii < t; ii++) {
string tk;
cin >> tk;
if(tk[0] == '-') {
continue;
}
int lptr = 1, rptr = 1;
while(tk[rptr] != '/') {
rptr++;
}
int tries = stoi(string(tk.begin() + lptr, tk.begin() + rptr));
lptr = rptr + 1;
rptr = lptr;
while(tk[rptr] != ':') {
rptr++;
}
int h = stoi(string(tk.begin() + lptr, tk.begin() + rptr));
lptr = rptr + 1;
rptr = lptr;
while(tk[rptr] != ':') {
rptr++;
}
int m = stoi(string(tk.begin() + lptr, tk.begin() + rptr));
int s = stoi(string(tk.begin() + rptr + 1, tk.end()));
solves++;
times += h * 60 * 60 + m * 60 + s + (tries - 1) * 20 * 60;
}
pT[i][0] = solves;
pT[i][1] = times;
}
vector<array<int,3>> fT;
for(auto& p : pT) {
if(names[p[2]] != names[pT.back()[2]]) {
fT.pb(p);
}
}
fT.pb(pT.back());
sort(itr(fT), [&](auto& a, auto& b){
if(a[0] != b[0]) {
return a[0] > b[0];
} else if(a[1] != b[1]) {
return a[1] < b[1];
} else {
return names[a[2]] < names[b[2]];
}
});
for(int i = 0; i < n; i++) {
// debug(fT[i][2]);
if(fT[i][2] == n) {
cout << i + 1 << "\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |