# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
735783 |
2023-05-04T16:22:49 Z |
sheldon |
Segway (COI19_segway) |
C++17 |
|
1000 ms |
896 KB |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("unroll-loops")
short int position[20005], speed[20005][3], charge[20005], boost[20005];
int ans[20005];
bool acc[20005], finished[20005];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> speed[i][0] >> speed[i][1] >> speed[i][2];
ans[i] = 1e9;
}
int m;
cin >> m;
for (int i = 0; i < m; ++i) {
int x;
cin >> x;
acc[x] = 1;
}
for (int sec = 1; sec <= 15000; ++sec) {
for (int i = 0; i < n; ++i) {
if (finished[i]) continue;
if (boost[i]) {
--boost[i];
++position[i];
continue;
}
int use = (position[i]) / 100;
++charge[i];
if (charge[i] == speed[i][use]) {
++position[i];
charge[i] = 0;
}
}
// cout << sec << ' ' << (int)position[0] << '\n';
vector<int> people[301];
for (int i = 0; i < n; ++i) {
if (position[i] == 300) {
finished[i] = 1;
ans[i] = min(ans[i], sec);
}
people[(int)position[i]].push_back(i);
}
int found = 0;
for (int i = 300; i >= 1; --i) {
if (acc[i]) {
int cnt = 0;
for (int x : people[i]) {
if (charge[x]) ++cnt;
}
for (int x : people[i]) {
if (!charge[x] && !boost[x]) {
boost[x] = (found + cnt) % 20;
}
}
}
found += people[i].size();
}
}
for (int i = 0; i < n; ++i) {
cout << ans[i] << '\n';
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
340 KB |
Output is correct |
2 |
Correct |
68 ms |
340 KB |
Output is correct |
3 |
Correct |
224 ms |
492 KB |
Output is correct |
4 |
Correct |
680 ms |
448 KB |
Output is correct |
5 |
Execution timed out |
1084 ms |
896 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
352 KB |
Output is correct |
2 |
Correct |
18 ms |
352 KB |
Output is correct |
3 |
Correct |
20 ms |
352 KB |
Output is correct |
4 |
Correct |
15 ms |
352 KB |
Output is correct |
5 |
Correct |
26 ms |
340 KB |
Output is correct |
6 |
Correct |
28 ms |
352 KB |
Output is correct |
7 |
Correct |
36 ms |
344 KB |
Output is correct |
8 |
Correct |
56 ms |
356 KB |
Output is correct |
9 |
Correct |
66 ms |
340 KB |
Output is correct |
10 |
Correct |
82 ms |
364 KB |
Output is correct |
11 |
Correct |
59 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
340 KB |
Output is correct |
2 |
Correct |
68 ms |
340 KB |
Output is correct |
3 |
Correct |
224 ms |
492 KB |
Output is correct |
4 |
Correct |
680 ms |
448 KB |
Output is correct |
5 |
Execution timed out |
1084 ms |
896 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |