Submission #1041416

#TimeUsernameProblemLanguageResultExecution timeMemory
1041416vjudge1Segway (COI19_segway)C++17
100 / 100
155 ms1792 KiB
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #include <iostream> #include <queue> #include <map> #include <vector> using namespace std; int const M=400,N=2e4+10; int sp[N]={}; bool acc[M]={}; inline void solve() { int n; cin>>n; int s[n][3]; for (auto& i:s) cin>>i[0]>>i[1]>>i[2]; int m; cin>>m; for (int i=0;i<m;i++) { int x;cin>>x;acc[x]=1; } map<int,vector<int>>d,z; for (int i=0;i<n;i++) d[0].push_back(i); for (int i=0;i<300;i++) { int cnt=0; for (auto j:d) { for (auto k:j.second) { if (acc[i]&&!sp[k]) { sp[k]+=cnt%20; } if (sp[k]) { z[j.first+1].push_back(k); sp[k]--; } else { z[j.first+s[k][i/100]].push_back(k); } } cnt+=j.second.size(); } d=z; z.clear(); } int ans[n]={}; for (auto i:d) { for(auto j:i.second) ans[j]=i.first; } for (auto i:ans) cout<<i<<endl; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...