Submission #869772

#TimeUsernameProblemLanguageResultExecution timeMemory
869772AriadnaGo (COCI16_go)C++14
50 / 50
1 ms348 KiB

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector < string > pokemon(n);
    vector < int > k(n), m(n);
    for (int i = 0; i < n; ++i) {
        cin >> pokemon[i] >> k[i] >> m[i];
    }
    
    int total = 0, max_evolutions = -1;
    string max_evolved;
    for (int i = 0; i < n; ++i) {
        int ev = 0;
        while (m[i] >= k[i]) {
            ev += m[i] / k[i];
            m[i] = (m[i] % k[i]) + 2 * (m[i] / k[i]);
        }
        if (ev > max_evolutions) {
            max_evolutions = ev;
            max_evolved = pokemon[i];
        }
        total += ev;
    }
    cout << total << '\n' << max_evolved << '\n';
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...