Submission #685255

#TimeUsernameProblemLanguageResultExecution timeMemory
6852553as8ACM (COCI19_acm)C++14
50 / 50
7 ms520 KiB
#include <bits/stdc++.h> #define ll long long #define endl "\n" using namespace std; bool comp(const pair<pair<ll,ll>, string> &a, const pair<pair<ll,ll>, string> &b){ if(a.first.first > b.first.first) return true; else if(a.first.first < b.first.first) return false; else { if( a.first.second < b.first.second) return true; else if(a.first.second > b.first.second) return false; else return a.second < b.second; } //return (a.first.first > b.first.first && a.first.second < b.first.second && a.second < b.second); } void getTeam(ll& penaltyTime, ll& solved, ll k ) { solved = 0; penaltyTime = 0; for(int j = 0; j < k; j++) { string s; cin>>s; char type = s[0]; back: if(type == '-') {} else { solved += 1; char atts = s[1]; ll attempts = int(atts) - 48; ll time = 0; ll mult = 3600; ll offset = 2; for(int l = 0; l < 3; l++) { char tensC = s[offset + 1], onesC = s[offset + 2]; ll tens = int(tensC) - 48, ones = int(onesC) - 48; time += ((tens * 10) + ones) * mult; mult /= 60; if(l != 2) offset += 1; offset += 2; } time += ((20 * 60) * (attempts - 1) ); penaltyTime += time; } } } void solve() { ll n, k; cin>>n>>k; map<string, pair<ll, ll> > teams; vector<pair<pair<ll, ll>, string> > teams1; for(int i = 0; i < n; i++) { string name; cin>>name; ll solved = 0; ll penaltyTime = 0; getTeam(penaltyTime, solved, k); if(name == "NijeZivotJedanACM") {} else { teams1.push_back({{solved, penaltyTime}, name}); } } string s; cin>>s; ll penalty, solved; getTeam(penalty, solved, k); pair<pair<ll, ll>, string> myTeam = {{solved, penalty}, s}; teams1.push_back(myTeam); sort(teams1.begin(), teams1.end(), comp); auto it = find(teams1.begin(), teams1.end(), myTeam); cout<<distance(teams1.begin(), it) + 1<<endl; //cout<<(n & (1 << k))<<endl; return; } int main(){ solve(); return 0; }

Compilation message (stderr)

acm.cpp: In function 'void getTeam(long long int&, long long int&, long long int)':
acm.cpp:29:9: warning: label 'back' defined but not used [-Wunused-label]
   29 |         back:
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...