# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143012 | 44442 | Go (COCI16_go) | C++11 | 3 ms | 504 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;
int n,k[80],m[80],a[80],ok[80],b[80],c[80],e;
string s[80];
pair<int,int>p[80];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
cin>>s[i]>>k[i]>>m[i];
}
for(int i=0;i<n;i++){
a[i]=m[i]/k[i];
ok[i]=2*a[i]+(m[i]-(a[i]*k[i]));
while(ok[i]>=k[i]){
b[i]=ok[i];
ok[i]=ok[i]/k[i];
a[i]=a[i]+ok[i];
c[i]=ok[i];
ok[i]=ok[i]*2+(b[i]-(ok[i]*k[i]));
}
p[i]=make_pair(a[i],i);
e=e+a[i];
}
sort(p,p+n);
int i=n-1;
while(p[i].first==p[i-1].first){
i--;
}
cout<<e<<endl<<s[p[i].second];
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |