# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711604 | pcc | ACM (COCI19_acm) | C++14 | 8 ms | 344 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 ll long long
string tar = "NijeZivotJedanACM";
struct node{
string name;
ll cnt,pen;
node(){
cnt = pen = 0;
}
bool operator<(node &b){
if(cnt != b.cnt)return cnt>b.cnt;
else if(pen != b.pen)return pen<b.pen;
else return name<b.name;
}
};
vector<node> v;
int main(){
int n,m;
cin>>n>>m;
string sssss;
getline(cin,sssss);
for(int j = 0;j<n;j++){
string in;
getline(cin,in);
// cout<<in<<endl<<endl;
stringstream ss(in);
ss>>in;
if(in == tar)continue;
node tmp;
tmp.name = in;
while(ss>>in){
if(in[0] != '-'){
tmp.cnt++;
}
string num;
for(int i = 1;i<in.size();i++){
if(in[i] == '/')break;
num += in[i];
}
if(num.empty())num = "1";
if(in[0] != '-')tmp.pen +=20*(stoi(num)-1)*60;
if(in[0] != '-'){
in = in.substr(in.size()-8,8);
tmp.pen += 3600*stoi(in.substr(0,2));
tmp.pen += 60*stoi(in.substr(3,2));
tmp.pen += stoi(in.substr(6,2));
}
}
v.push_back(tmp);
}
string in;
getline(cin,in);
stringstream ss(in);
ss>>in;
node tmp;
tmp.name = in;
while(ss>>in){
if(in[0] != '-'){
tmp.cnt++;
}
string num;
for(int i = 1;i<in.size();i++){
if(in[i] == '/')break;
num += in[i];
}
if(num.empty())num = "1";
if(in[0] != '-')tmp.pen +=20*(stoi(num)-1)*60;
if(in[0] != '-'){
in = in.substr(in.size()-8,8);
tmp.pen += 3600*stoi(in.substr(0,2));
tmp.pen += 60*stoi(in.substr(3,2));
tmp.pen += stoi(in.substr(6,2));
}
}
v.push_back(tmp);
sort(v.begin(),v.end());
// cout<<endl;
// for(auto &i:v)cout<<i.name<<' '<<i.cnt<<' '<<i.pen<<endl;
// cout<<endl;
for(int i =0;i<v.size();i++){
if(v[i].name == tar){
cout<<i+1<<'\n';
return 0;
}
}
cout<<"ERROR\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |