Submission #168618

#TimeUsernameProblemLanguageResultExecution timeMemory
168618ahmetSegway (COI19_segway)C++14
100 / 100
738 ms1572 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=1e5+5; int n,m,speed1[20001],speed2[20001],speed3[20001]; bool acc[301]; int ans[20001],gidilecek_yol[20001]; bool hala_acc_da_mi[20001]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for(int i=0;i<n;i++) { cin >> speed1[i] >> speed2[i]>>speed3[i]; ans[i]=0; gidilecek_yol[i]=0; } cin >> m; int t; for(int i=0;i<m;i++) { cin >> t; acc[t]=1;//acc varsa 1 } for(int i=1;i<=300;i++) { for(int j=0;j<n;j++) { if(hala_acc_da_mi[j]) { ans[j]++; gidilecek_yol[j]--; if(gidilecek_yol[j]<=0)hala_acc_da_mi[j]=0; } else { if(i<=100)ans[j]+=speed1[j]; else if(i<=200)ans[j]+=speed2[j]; else { ans[j]+=speed3[j]; } } } if(acc[i]) { vector<pair<int,int> >temp; for(int j=0;j<n;j++) { temp.push_back(make_pair(ans[j],j)); } sort(temp.begin(),temp.end()); int previ=0; for(int j=1;j<n;j++) { if(temp[j].first!=temp[previ].first)previ=j; int pos=temp[j].second; if(hala_acc_da_mi[pos] || previ%20==0)continue; hala_acc_da_mi[pos]=1; gidilecek_yol[pos]=previ%20; } } } for(int 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...