#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define X first
#define Y second
typedef pair <int, int> pii;
const int MAXN = 2e4 + 5;
int n, m;
int brzina[MAXN][3];
int akcelerator[305];
int akc[MAXN];
vector <pii> vrijeme;
int konacno[MAXN];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> brzina[i][0];
cin >> brzina[i][1];
cin >> brzina[i][2];
}
cin >> m;
for (int i = 0; i < m; i++) {
int p; cin >> p;
akcelerator[p]++;
}
for (int i = 0; i < n; i++) vrijeme.pb({0, i});
for (int i = 0; i < 300; i++) {
int ispred = 0;
//cout << i << " : ";
for (int x = 0; x < n; x++) {
int oznaka = vrijeme[x].Y;
if (x && vrijeme[x].X != vrijeme[x - 1].X) ispred = x;
if (akcelerator[i] && !akc[oznaka]) akc[oznaka] = ispred % 20;
if (akc[oznaka]) {
konacno[oznaka]++;
akc[oznaka]--;
}
else {
if (i < 100) konacno[oznaka] += brzina[oznaka][0];
else if (i < 200) konacno[oznaka] += brzina[oznaka][1];
else konacno[oznaka] += brzina[oznaka][2];
}
//cout << vrijeme[i][x].X << "-" << vrijeme[i][x].Y;
//cout << "(" << akc[oznaka] << ") ";
}
vrijeme.clear();
for (int x = 0; x < n; x++) vrijeme.pb({konacno[x], x});
sort(vrijeme.begin(), vrijeme.end());
//cout << '\n';
}
for (int i = 0; i < n; i++) cout << konacno[i] << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
21 ms |
384 KB |
Output is correct |
4 |
Correct |
85 ms |
512 KB |
Output is correct |
5 |
Correct |
658 ms |
1396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
6 ms |
384 KB |
Output is correct |
8 |
Correct |
8 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
384 KB |
Output is correct |
10 |
Correct |
10 ms |
384 KB |
Output is correct |
11 |
Correct |
9 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
21 ms |
384 KB |
Output is correct |
4 |
Correct |
85 ms |
512 KB |
Output is correct |
5 |
Correct |
658 ms |
1396 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
8 ms |
512 KB |
Output is correct |
14 |
Correct |
10 ms |
384 KB |
Output is correct |
15 |
Correct |
10 ms |
384 KB |
Output is correct |
16 |
Correct |
9 ms |
384 KB |
Output is correct |
17 |
Correct |
26 ms |
384 KB |
Output is correct |
18 |
Correct |
57 ms |
504 KB |
Output is correct |
19 |
Correct |
279 ms |
864 KB |
Output is correct |
20 |
Correct |
346 ms |
896 KB |
Output is correct |
21 |
Correct |
490 ms |
1076 KB |
Output is correct |
22 |
Correct |
668 ms |
1272 KB |
Output is correct |
23 |
Correct |
626 ms |
1244 KB |
Output is correct |