# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222576 | kingfran1907 | Segway (COI19_segway) | C++14 | 293 ms | 1404 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e4+10;
int n, m;
int v[maxn][3];
int dis[maxn];
int ac[maxn];
bool flag[maxn];
vector< pair<int, int> > tren, cp;
int main() {
memset(flag, false, sizeof flag);
scanf("%d", &n);
for (int i = 0; i < n; i++)
for (int j = 0; j < 3; j++)
scanf("%d", &v[i][j]);
scanf("%d", &m);
for (int i = 0; i < m; i++) {
int x;
scanf("%d", &x);
flag[x] = true;
}
for (int i = 0; i < n; i++)
tren.push_back(make_pair(0, i));
for (int t = 0; t < 300; t++) {
cp.clear();
int cnt = 0;
int preftim = -1;
for (int i = 0; i < n; i++) {
int tim = tren[i].first;
int ind = tren[i].second;
if (tim != preftim) cnt = i;
preftim = tim;
if (flag[t] && ac[ind] == 0) ac[ind] = cnt % 20;
if (ac[ind] > 0) {
ac[ind]--;
dis[ind]++;
} else
dis[ind] += v[ind][t / 100];
cp.push_back(make_pair(dis[ind], ind));
}
tren = cp;
sort(tren.begin(), tren.end());
}
for (int i = 0; i < n; i++)
printf("%d\n", dis[i]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |