Submission #448529

#TimeUsernameProblemLanguageResultExecution timeMemory
448529MOUF_MAHMALATSegway (COI19_segway)C++11
0 / 100
4 ms1100 KiB
#include<bits/stdc++.h> #define all(s) s.begin(),s.end() using namespace std; typedef int ll; ll n,m,x,ans[20009],id[20009],a[20009][3],op[20009],p[309]; bool b[309]; vector<vector<ll> >v; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); v.resize(15009); cin>>n; for(ll i=0; i<n; i++) for(ll j=0; j<3; j++) cin>>a[i][j]; cin>>m; for(ll i=0;i<m;i++) { cin>>x; b[x]=1; } for(ll i=0;i<n;i++) v[a[i][0]].push_back(i); for(ll i=1;i<=15000;i++) { for(auto z:v[i]) { id[z]++; if(b[id[z]]&&op[z]==0){ op[z]=p[id[z]]%20; } if(id[z]==300) ans[z]=i; else { if(op[z]) op[z]--,v[i+1].push_back(z); else v[i+a[z][id[z]/100]].push_back(z); } } for(auto z:v[i]) p[id[z]-1]++; } for(ll i=0;i<n;i++) cout<<ans[i]<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...