Submission #168551

#TimeUsernameProblemLanguageResultExecution timeMemory
168551ahmetSegway (COI19_segway)C++14
15 / 100
12 ms1400 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(long long (i)=0;(i)<(n);++(i)) #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i)) #define endl '\n' #define st first #define nd second #define pb push_back #define mp make_pair const int mx=3e4+5; int a[mx],b[mx],c[mx],ans[mx]; int n,m,res[mx]; int main(){ /*freopen(".in", "r", stdin); freopen(".out", "w", stdout); */ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n; rep(i,n){ cin >> a[i] >> b[i] >> c[i]; } cin >> m; vector <int > v; priority_queue <pair <int,int> ,vector <pair <int,int > > ,greater <pair <int,int> >> pq; rep(i,m){int xx;cin >> xx;v.pb(xx);} for(int i=0;i<n;++i){ if(v[0]<100){ pq.push(mp(v[0]*a[i],i)); } else if(v[0]<200){ pq.push(mp(a[i]*100+b[i]*(v[0]-99),i)); } else pq.push(mp(a[i]*100+b[i]*100+c[i]*(v[0]-199),i)); } int say=0; int onc=-1; int ov=-1; while(!pq.empty()){ int x=pq.top().second; if(!pq.empty() and onc==pq.top().first) ans[x]=ov; else ans[x]=say%20; //cout << x << " " << say << endl; ++say; onc=pq.top().first; ov=ans[x]; pq.pop(); } for(int i=0;i<n;++i){ if(v[0]<100){ if(ans[i]+v[0]<100){ res[i]=(b[i]+c[i])*100+(100-ans[i])*a[i]+ans[i]; } else if(ans[i]+v[0]<200){ res[i]=c[i]*100+(v[0])*a[i]+(200-v[0]-ans[i])*b[i]+ans[i]; } } else if(v[0]<200){ if(ans[i]+v[0]<200){ res[i]=(a[i]+c[i])*100+(100-ans[i])*b[i]+ans[i]; } else if(ans[i]+v[0]<300){ res[i]=a[i]*100+(v[0]-100)*b[i]+ans[i]+(300-v[0]-ans[i])*c[i]; } } else{ if(ans[i]+v[0]<300){ res[i]=(100-ans[i])*c[i]+(a[i]+b[i])*100+ans[i]; } else{ res[i]=(v[0]-200)*c[i]+300-v[0]+(a[i]+b[i])*100; } } } rep(i,n){ cout << res[i] << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...