답안 #769033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
769033 2023-06-29T05:22:20 Z t6twotwo 식물 비교 (IOI20_plants) C++17
14 / 100
4000 ms 6120 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N, K;
vector<int> R, A;
int dis(int x, int y) {
	if (x < y) {
		return y - x;
	} else {
		return N - x + y;
	}
}
void init(int k, std::vector<int> r) {
	K = k, R = r; N = R.size();
	A.resize(N, -1);
	for (int i = 0; i < N; i++) {
		vector<int> v;
		for (int j = 0; j < N; j++) {
			if (A[j] == -1 && R[j] == K - 1) {
				v.push_back(j);
			}
		}
		int m = v.size(), p;
		vector<int> c;
		if (m == 1) {
			c = {v[0]};
		} else {
			for (int j = 0; j < m; j++) {
				if (dis(v[j], v[(j + 1) % m]) >= K) {
					c.push_back(v[(j + 1) % m]);
				}
			}
		}
		assert(i || c.size() == 1);
		p = c[0];
		A[p] = i;
		for (int j = 1; j < K; j++) {
			R[(p - j + N) % N]++;
		}
	}
}
 
int compare_plants(int x, int y) {
	return A[x] > A[y] ? 1 : -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Runtime error 1 ms 428 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 308 KB Output is correct
7 Correct 181 ms 3600 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 7 ms 340 KB Output is correct
10 Correct 164 ms 3552 KB Output is correct
11 Correct 121 ms 3404 KB Output is correct
12 Correct 187 ms 3784 KB Output is correct
13 Correct 195 ms 3560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 308 KB Output is correct
7 Correct 181 ms 3600 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 7 ms 340 KB Output is correct
10 Correct 164 ms 3552 KB Output is correct
11 Correct 121 ms 3404 KB Output is correct
12 Correct 187 ms 3784 KB Output is correct
13 Correct 195 ms 3560 KB Output is correct
14 Correct 2176 ms 3740 KB Output is correct
15 Execution timed out 4046 ms 6120 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 1 ms 340 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 1 ms 468 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Runtime error 1 ms 428 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -