Submission #233306

#TimeUsernameProblemLanguageResultExecution timeMemory
233306VEGAnnSegway (COI19_segway)C++14
0 / 100
1095 ms512 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 j = i; int kol = min(300 - pos, (i + 1) % 20); while (j < n && tim[nm[i]] == tim[nm[j]]){ int loc = nm[j]; ans[j] = tim[j] + kol; int ps = pos + kol; if (ps < 100){ ans[j] += a[i][0] * (100 - ps) + a[i][1] * 100 + a[i][2] * 100; } else if (ps < 200){ ans[j] += a[i][1] * (200 - ps) + a[i][2] * 100; } else { ans[j] += a[i][2] * (300 - ps); } j++; } } for (int i = 0; i < n; i++) cout << ans[i] << '\n'; return 0; }

Compilation message (stderr)

segway.cpp: In function 'int main()':
segway.cpp:53:17: warning: unused variable 'loc' [-Wunused-variable]
             int loc = nm[j];
                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...