답안 #1041460

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041460 2024-08-02T04:15:05 Z vjudge1 Segway (COI19_segway) C++17
100 / 100
130 ms 120980 KB
#include <iostream>
#include <vector>

using namespace std;
const int N = 20000 + 10;
vector<pair<int,int>> vec[N], num[N];
int sp[N][3];
int passed[N];
int acc[N];
int finish[N];

int main(){
	int n,M;
	cin>>n;

	for (int i=1;i<=n;i++){
		for (int j : {0, 1, 2})
			cin>>sp[i][j];
		vec[sp[i][0]].push_back({i, 1});
	}
	cin>>M;
	for (int i=1, a;i<=M;i++){
		cin>>a;
		acc[a] = 1;
	}
	for (int sec=1;sec<=15000;sec++){
		for (auto [i,m] : vec[sec]){
			if (m == 300){
				finish[i] = sec;
				passed[m]++;
				continue;
			}
			if (acc[m] and passed[m] % 20 != 0){
				int k = min(300 - m, passed[m] % 20);
				vec[sec + k].push_back({i, m + k});
				for (int j=0;j<k;j++)
					num[sec + j].push_back({m + j, 0});
				continue;
			}
			vec[sec + sp[i][m / 100]].push_back({i, m + 1});
			num[sec].push_back({m, 0});
		}
		for (auto [m, zero] : num[sec])
			passed[m]++;
	}

	for (int i=1;i<=n;i++)
		cout<<finish[i]<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Correct 3 ms 2652 KB Output is correct
3 Correct 8 ms 6744 KB Output is correct
4 Correct 21 ms 21340 KB Output is correct
5 Correct 130 ms 120980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1372 KB Output is correct
4 Correct 1 ms 1372 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1628 KB Output is correct
7 Correct 2 ms 1884 KB Output is correct
8 Correct 2 ms 2396 KB Output is correct
9 Correct 3 ms 2396 KB Output is correct
10 Correct 3 ms 2908 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Correct 3 ms 2652 KB Output is correct
3 Correct 8 ms 6744 KB Output is correct
4 Correct 21 ms 21340 KB Output is correct
5 Correct 130 ms 120980 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1628 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 2 ms 1884 KB Output is correct
13 Correct 2 ms 2396 KB Output is correct
14 Correct 3 ms 2396 KB Output is correct
15 Correct 3 ms 2908 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 10 ms 8028 KB Output is correct
18 Correct 9 ms 8796 KB Output is correct
19 Correct 40 ms 36140 KB Output is correct
20 Correct 65 ms 64172 KB Output is correct
21 Correct 69 ms 57172 KB Output is correct
22 Correct 81 ms 65840 KB Output is correct
23 Correct 74 ms 61904 KB Output is correct