Submission #1217183

#TimeUsernameProblemLanguageResultExecution timeMemory
1217183Younis_DwaiGo (COCI16_go)C++20
50 / 50
0 ms328 KiB
//#pragma GCC optimize("Ofast,O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define popp pop_back
#define in insert
#define endl "\n"
//#define mid (l+r)/2
using namespace std;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int n;
    cin>>n;
    int ret=0,mx=-1;
    string T;
    for(int i=1;i<=n;i++){
        string s;cin>>s;
        int need,have;cin>>need>>have;
        int cur=0;
        while(have>=need){
              int cnt=have/need;
              ret+=cnt;cur+=cnt;
              have%=need;
              have+=2*cnt;
        }
        if(cur>mx){
           mx=cur;
           T=s;
        }
    }
    cout<<ret<<endl<<T;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...