Submission #143012

# Submission time Handle Problem Language Result Execution time Memory
143012 2019-08-12T15:07:00 Z 44442 Go (COCI16_go) C++11
50 / 50
3 ms 504 KB
#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
1 Correct 3 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 380 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct