# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769826 | 2023-06-30T09:55:25 Z | anha3k25cvp | Segway (COI19_segway) | C++14 | 2 ms | 340 KB |
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define dl double #define st first #define nd second #define II pair <int, int> using namespace std; const int N = 5 + 1e5; const int inf = 7 + 1e9; vector <int> vis, ans, cnt; vector <vector <int>> a; int main() { #define TASKNAME "" ios_base :: sync_with_stdio (0); cin.tie (0); if ( fopen( TASKNAME".inp", "r" ) ) { freopen (TASKNAME".inp", "r", stdin); freopen (TASKNAME".out", "w", stdout); } int n; cin >> n; a.assign(n + 1, vector <int> (3, 0)); for (int i = 1; i <= n; i ++) for (int j = 0; j < 3; j ++) cin >> a[i][j]; int m; cin >> m; vis.assign(301, 0); while (m --) { int x; cin >> x; vis[x] = 1; } ans.assign(n + 1, 0); cnt.assign(n + 1, 0); for (int pos = 0; pos < 300; pos ++) { vector <int> c; for (int i = 1; i <= n; i ++) c.push_back(ans[i]); sort(c.begin(), c.end()); c.resize(unique(c.begin(), c.end()) - c.begin()); for (int i = 1; i <= n; i ++) { if (vis[pos]) { int val = lower_bound(c.begin(), c.end(), ans[i]) - c.begin(); if (!cnt[i]) cnt[i] = val % 20; } if (cnt[i]) { ans[i] ++; cnt[i] --; } else ans[i] += a[i][pos / 100]; } } for (int i = 1; i <= n; i ++) cout << ans[i] << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 2 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 2 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |