Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- int n, p, g, x, z, k;
- int v[101];
- int main() {
- fin >> n;
- for(x=0; x<n; x++){
- fin >> p >> g;
- v[p]+=g;
- }
- for(x=0; x<=100; x++){
- if(v[x]>z){
- z=v[x];
- k=x;
- }
- }
- fout << k <<" "<< z;
- }
Add Comment
Please, Sign In to add comment