Submission #233309

#TimeUsernameProblemLanguageResultExecution timeMemory
233309VEGAnnSegway (COI19_segway)C++14
15 / 100
13 ms1024 KiB
#include <bits/stdc++.h> #define all(x) x.begin(),x.end() #define PB push_back using namespace std; const int N = 20100; const int md = int(1e9) + 7; int a[N][3], n, nm[N], tim[N], m, pos, ans[N]; bool cmp(int _x, int _y){ return tim[_x] < tim[_y]; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL cin >> n; for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1] >> a[i][2]; cin >> m; assert(m == 1); cin >> pos; for (int i = 0; i < n; i++){ tim[i] = 0; if (pos < 100){ tim[i] = a[i][0] * pos; } else if (pos < 200){ tim[i] = a[i][1] * (pos - 100) + a[i][0] * 100; } else { tim[i] = a[i][2] * (pos - 200) + a[i][1] * 100 + a[i][0] * 100; } nm[i] = i; } sort(nm, nm + n, cmp); for (int i = 0; i < n; ){ int loc = i; int kol = min(300 - pos, i % 20); while (loc < n && tim[nm[i]] == tim[nm[loc]]){ int j = nm[loc]; ans[j] = tim[j] + kol; int ps = pos + kol; if (ps < 100){ ans[j] += a[j][0] * (100 - ps) + a[j][1] * 100 + a[j][2] * 100; } else if (ps < 200){ ans[j] += a[j][1] * (200 - ps) + a[j][2] * 100; } else { ans[j] += a[j][2] * (300 - ps); } loc++; } i = loc; } for (int i = 0; i < n; i++) cout << ans[i] << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...