답안 #117700

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
117700 2019-06-17T06:48:42 Z 윤지학(#2883) Segway (COI19_segway) C++14
100 / 100
97 ms 1568 KB
#include <cstdio>
#include <vector>

using namespace std;

int a[20002][3], b[20002], c[20002], r[20002], e[303], f[303];
vector<int> d[15005];

int main() {
	int i, j, k, n, m;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < 3; j++) scanf("%d", &a[i][j]);
		d[0].push_back(i);
	}
	scanf("%d", &m);
	while (m--) {
		scanf("%d", &i);
		e[i] = 1;
	}
	for (i = 0; i <= 15000; i++) {
		for (auto t : d[i]) {
			if (b[t] == 300) {
				r[t] = i;
				continue;
			}
			if (e[b[t]] && !c[t]) c[t] = f[b[t]] % 20;
			if (c[t]) {
				c[t]--;
				d[i + 1].push_back(t);
				continue;
			}
			d[i + a[t][b[t] / 100]].push_back(t);
		}
		for (auto t : d[i]) f[b[t]++]++;
		d[i].clear();
		d[i].shrink_to_fit();
	}
	for (i = 0; i < n; i++) printf("%d\n", r[i]);
}

Compilation message

segway.cpp: In function 'int main()':
segway.cpp:10:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k, n, m;
            ^
segway.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
segway.cpp:13:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (j = 0; j < 3; j++) scanf("%d", &a[i][j]);
                           ~~~~~^~~~~~~~~~~~~~~~
segway.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
  ~~~~~^~~~~~~~~~
segway.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &i);
   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 4 ms 640 KB Output is correct
3 Correct 7 ms 640 KB Output is correct
4 Correct 15 ms 768 KB Output is correct
5 Correct 97 ms 1432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 3 ms 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 4 ms 640 KB Output is correct
10 Correct 4 ms 768 KB Output is correct
11 Correct 4 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 4 ms 640 KB Output is correct
3 Correct 7 ms 640 KB Output is correct
4 Correct 15 ms 768 KB Output is correct
5 Correct 97 ms 1432 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 640 KB Output is correct
14 Correct 4 ms 640 KB Output is correct
15 Correct 4 ms 768 KB Output is correct
16 Correct 4 ms 640 KB Output is correct
17 Correct 8 ms 640 KB Output is correct
18 Correct 7 ms 768 KB Output is correct
19 Correct 31 ms 1124 KB Output is correct
20 Correct 46 ms 1112 KB Output is correct
21 Correct 53 ms 1380 KB Output is correct
22 Correct 66 ms 1496 KB Output is correct
23 Correct 57 ms 1568 KB Output is correct