답안 #234595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234595 2020-05-24T17:54:22 Z pedy4000 Segway (COI19_segway) C++14
100 / 100
208 ms 1024 KB
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int N = 2e4 + 8;
int n, m;
bool mark[N];
int speed[N][3];
int val[N];
int Arr[N];
int upd[N];

bool cmp(int a, int b) {
	return val[a] < val[b];
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 3; j++)
			cin >> speed[i][j];

	cin >> m;
	while (m--) {
		int a;
		cin >> a;
		mark[a] = true;
	}

	for (int i = 0; i < n; i++)
		Arr[i] = i;

	for (int i = 1; i <= 300; i++) {
		for (int j = 0; j < n; j++) {
			if (upd[j]) {
				upd[j]--;
				val[j]++;
			}
			else
				val[j] += speed[j][(i - 1) / 100];
		}

		if (mark[i]) {
			sort(Arr, Arr + n, cmp);
			int nxt = 0;
			for (int j = 0; j < n; j++) {
				if (j && val[Arr[j - 1]] != val[Arr[j]])
					nxt = j;
				if (upd[Arr[j]] == 0)
					upd[Arr[j]] = nxt % 20;
			}
		}
	}

	for (int i = 0; i < n; i++)
		cout << val[i] << "\n";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 19 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 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 5 ms 384 KB Output is correct
8 Correct 5 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 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 19 ms 1024 KB Output is correct
6 Correct 5 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 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 6 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 22 ms 384 KB Output is correct
19 Correct 47 ms 736 KB Output is correct
20 Correct 23 ms 768 KB Output is correct
21 Correct 82 ms 1016 KB Output is correct
22 Correct 167 ms 1020 KB Output is correct
23 Correct 208 ms 1024 KB Output is correct