#include<bits/stdc++.h>
using namespace std;
const int N = 20'000 + 10;
int n, sp[N][3], t[N], boost[N];
bool a[300];
int main()
{
cin >> n;
for(int i = 1; i <= n; i ++)
for(int j = 0; j < 3; j++)
cin >> sp[i][j];
int m;
cin >> m;
for(int i = 0; i < m; i ++)
{
int x;
cin >> x;
a[x] = true;
}
for(int d = 0; d < 300; d ++)
{
vector<pair<int,int> > st;
for(int i = 1; i <= n; i++)
st.push_back({t[i], i});
sort(st.begin(), st.end());
vector<int> ahead(n);
ahead[0] = 0;
for(int i = 1; i < n; i ++)
if(st[i].first == st[i - 1].first)
ahead[i] = ahead[i - 1];
else
ahead[i] = i % 20;
for(int i = 0; i < n; i ++)
{
int cur = st[i].second;
if(a[d] && !boost[cur])
boost[cur] = ahead[i];
if(boost[cur] > 0)
t[cur]++, boost[cur]--;
else
t[cur] += sp[cur][d / 100];
}
}
for(int i = 1; i <= n; i ++)
cout << t[i] << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
12 ms |
484 KB |
Output is correct |
4 |
Correct |
49 ms |
348 KB |
Output is correct |
5 |
Correct |
448 ms |
1216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
10 |
Correct |
3 ms |
348 KB |
Output is correct |
11 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
12 ms |
484 KB |
Output is correct |
4 |
Correct |
49 ms |
348 KB |
Output is correct |
5 |
Correct |
448 ms |
1216 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
3 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
348 KB |
Output is correct |
17 |
Correct |
12 ms |
348 KB |
Output is correct |
18 |
Correct |
31 ms |
348 KB |
Output is correct |
19 |
Correct |
183 ms |
832 KB |
Output is correct |
20 |
Correct |
231 ms |
892 KB |
Output is correct |
21 |
Correct |
319 ms |
1000 KB |
Output is correct |
22 |
Correct |
458 ms |
1252 KB |
Output is correct |
23 |
Correct |
418 ms |
1252 KB |
Output is correct |