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 <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int N = 2e4 + 8;
int n, m;
bool mark[N];
int speed[N][3];
int val[N];
int Arr[N];
int upd[N];
bool cmp(int a, int b) {
return val[a] < val[b];
}
int main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < 3; j++)
cin >> speed[i][j];
cin >> m;
while (m--) {
int a;
cin >> a;
mark[a] = true;
}
for (int i = 0; i < n; i++)
Arr[i] = i;
for (int i = 1; i <= 300; i++) {
for (int j = 0; j < n; j++) {
if (upd[j]) {
upd[j]--;
val[j]++;
}
else
val[j] += speed[j][(i - 1) / 100];
}
if (mark[i]) {
sort(Arr, Arr + n, cmp);
int nxt = 0;
for (int j = 0; j < n; j++) {
if (j && val[Arr[j - 1]] != val[Arr[j]])
nxt = j;
if (upd[Arr[j]] == 0)
upd[Arr[j]] = nxt % 20;
}
}
}
for (int i = 0; i < n; i++)
cout << val[i] << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |