#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[305];
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] >> brzina[i][1] >> brzina[i][2];
}
cin >> m;
int p;
for (int i = 0; i < m; i++) {
cin >> p; p++;
akcelerator[p]++;
}
for (int i = 0; i < n; i++) {
vrijeme[0].pb({0, i});
}
/*
cout << "0 : ";
for (auto x : vrijeme[0]) {
cout << x.X << "-" << x.Y;
cout << "(" << akc[x.Y] << ") ";
}
cout << '\n';
*/
int oznaka, vp, bp;
for (int i = 1; i <= 300; i++) {
vrijeme[i].resize(n);
vp = -1, bp = 0;
//cout << i << " : ";
for (int x = 0; x < n; x++) {
vrijeme[i][x] = vrijeme[i - 1][x];
oznaka = vrijeme[i][x].Y;
if (vrijeme[i][x].X > vp) {
vp = vrijeme[i][x].X;
bp = x;
}
if (akcelerator[i] && !akc[oznaka]) akc[oznaka] = bp;
if (akc[oznaka] > 0) vrijeme[i][x].X++;
else {
if (i <= 100) vrijeme[i][x].X += brzina[oznaka][0];
else if (i <= 200) vrijeme[i][x].X += brzina[oznaka][1];
else vrijeme[i][x].X += brzina[oznaka][2];
}
//cout << vrijeme[i][x].X << "-" << vrijeme[i][x].Y;
//cout << "(" << akc[oznaka] << ") ";
akc[oznaka] = max(0, akc[oznaka] - 1);
}
sort(vrijeme[i].begin(), vrijeme[i].end());
//cout << '\n';
}
for (int i = 0; i < n; i++) {
konacno[vrijeme[300][i].Y] = vrijeme[300][i].X;
}
for (int i = 0; i < n; i++) {
cout << konacno[i] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
6 ms |
768 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
436 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Incorrect |
5 ms |
512 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
6 ms |
768 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |