# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685255 | 3as8 | ACM (COCI19_acm) | C++14 | 7 ms | 520 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>
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |