# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222362 | dwsc | ACM (COCI19_acm) | C++14 | 71 ms | 896 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 pair<string,vector<string>> vs;
typedef pair<int,int> ii;
string target ="NijeZivotJedanACM";
vs actual;
ii score(vs team){
vector<string> use;
ii val = ii(0,0);
if (team.first == target){
use = actual.second;
for (int i = 0; i < use.size(); i++){
string sub = use[i];
if (sub[0] == '+'){
val.first++;
int slash = -1;
string subtime = "";
for (int j = 3; j < sub.length(); j++){
subtime += sub[j];
}
val.second -= (sub[1]-48-1)*1200;
val.second -= (((subtime[1]-48)*3600)+((subtime[3]-48)*600)+((subtime[4]-48)*60)+((subtime[6]-48)*10)+(subtime[7]-48));
}
}
}
else{
use = team.second;
for (int i = 0; i < use.size(); i++){
string sub = use[i];
if (sub[0] == '+' || sub[0] == '?'){
val.first++;
int slash = -1;
string subtime = "";
for (int j = 3; j < sub.length(); j++){
subtime += sub[j];
}
val.second -= (sub[1]-48-1)*1200;
val.second -= (((subtime[1]-48)*3600)+((subtime[3]-48)*600)+((subtime[4]-48)*60)+((subtime[6]-48)*10)+(subtime[7]-48));
}
}
}
return val;
}
bool cmp(vs team1,vs team2){
ii s1 = score(team1),s2 = score(team2);
if (s1 > s2) return 1;
if (s2 > s1) return 0;
return (team1.first < team2.first);
}
int main(){
int n,m;
cin >> n >> m;
vs arr[n];
for (int i = 0; i < n; i++){
string name;
cin >> name;
vector<string> subs;
for (int j = 0; j < m; j++){
string sub;
cin >> sub;
subs.push_back(sub);
}
arr[i] = vs(name,subs);
}
string name;
cin >> name;
vector<string> subs;
for (int i = 0; i < m; i++){
string sub;
cin >> sub;
subs.push_back(sub);
}
actual = vs(name,subs);
sort(arr,arr+n,cmp);
for (int i = 0; i < n; i++) if (arr[i].first == target) cout << i+1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |