Submission #208865

# Submission time Handle Problem Language Result Execution time Memory
208865 2020-03-12T11:09:46 Z MertD014 Go (COCI16_go) C++17
50 / 50
5 ms 380 KB
#include <bits/stdc++.h>
#define ll  long long
#define pb  push_back
#define pob pop_back
using namespace std;

pair<string,int> d[100];

int a,b,ans,aans,n;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>d[i].first;
		cin>>a>>b;
		ans=b/a;
		b+=ans*(2-a);
		while(b>=a){
			ans++;
			b-=a;
			b+=2;
		}
		d[i].second=ans;
		aans+=ans;
	}

	int mx=INT_MIN,mxi;
	for(int i=n-1;i>=0;i--){
		if(d[i].second>=mx){
			mx=d[i].second;
			mxi=i;
		}
	}

	cout<<aans<<endl<<d[mxi].first;


	return 0;
}

Compilation message

go.cpp: In function 'int main()':
go.cpp:27:17: warning: 'mxi' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int mx=INT_MIN,mxi;
                 ^~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 248 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 256 KB Output is correct
25 Correct 5 ms 380 KB Output is correct