# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340242 | A_D | ACM (COCI19_acm) | C++14 | 7 ms | 492 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.
/*
ID: antwand1
TASK: barn1
LANG: C++
*/
#include <bits/stdc++.h>
#define ll long long
#define du long double
#define F first
#define S second
using namespace std;
const int N=1e3+100;
string f="NijeZivotJedanACM";
pair<pair<ll,ll>,string> a[N];
main()
{
//freopen("barn1.in","r",stdin);freopen("barn1.out","w",stdout);
int n,m;
cin>>n>>m;
int cu=0;
for(int i=1;i<=n;i++){
string res;
cin>>res;
if(res==f){
cu=i;
}
ll ad=0,pen=0;
for(int j=1;j<=m;j++){
ll ben=0;
string t;
cin>>t;
if(t[0]=='-')continue;
ad++;
ll q=0;
reverse(t.begin(),t.end());
t.pop_back();
while(t.back()!='/'){
ben*=10;
ben+=t.back()-'0';
t.pop_back();
}
t.pop_back();
ben*=20*60;
int h=(t[0]-'0')*10+(t[1]-'0');
ben+=h*3600;
t.pop_back();t.pop_back();t.pop_back();
h=(t[0]-'0')*10+(t[1]-'0');
ben+=h*60;
t.pop_back();t.pop_back();t.pop_back();
h=(t[0]-'0')*10+(t[1]-'0');
ben+=h;
pen+=ben;
}
a[i]={{-ad,pen},res};
}
string res;
cin>>res;
int i=cu;
ll ad=0,pen=0;
for(int j=1;j<=m;j++){
ll ben=0;
string t;
cin>>t;
if(t[0]=='-')continue;
ad++;
ll q=0;
reverse(t.begin(),t.end());
t.pop_back();
while(t.back()!='/'){
ben*=10;
ben+=t.back()-'0';
t.pop_back();
}
t.pop_back();
ben*=20*60;
int h=(t[0]-'0')*10+(t[1]-'0');
ben+=h*3600;
t.pop_back();t.pop_back();t.pop_back();
h=(t[0]-'0')*10+(t[1]-'0');
ben+=h*60;
t.pop_back();t.pop_back();t.pop_back();
h=(t[0]-'0')*10+(t[1]-'0');
ben+=h;
pen+=ben;
}
a[i]={{-ad,+pen},res};
sort(a+1,a+n+1);
for(int i=1;i<=n;i++){
// cout<<a[i].F.F<<" "<<a[i].F.S<<" "<<a[i].S<<endl;
if(a[i].S==f){
cout<<i<<endl;
//break;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |