답안 #303098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
303098 2020-09-19T22:02:33 Z tutis 식물 비교 (IOI20_plants) C++17
5 / 100
115 ms 5880 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>k0, k1;
int K, n;
void init(int k, vector<int> r)
{
	K = k;
	n = r.size();
	if (k == 2)
	{
		k0 = k1 = vector<int>(n, 0);
		for (int t = 0; t < 2; t++)
			for (int i = n - 1; i >= 0; i--)
			{
				if (r[i] == 0)
					k0[i] = 1 + k0[(i + 1) % n];
				else
					k1[i] = 1 + k1[(i + 1) % n];
			}
	}
}

int compare_plants(int x, int y)
{
	assert(x < y);
	if (K == 2)
	{
		if (k0[x] >= y - x)
			return 1;
		if (k1[x] >= y - x)
			return -1;
		if (k0[y] >= n - y + x)
			return -1;
		if (k1[y] >= n - y + x)
			return 1;
		return 0;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 65 ms 3192 KB Output is correct
7 Correct 82 ms 3448 KB Output is correct
8 Correct 110 ms 5880 KB Output is correct
9 Correct 107 ms 5752 KB Output is correct
10 Correct 113 ms 5752 KB Output is correct
11 Correct 115 ms 5752 KB Output is correct
12 Correct 108 ms 5752 KB Output is correct
13 Correct 102 ms 5752 KB Output is correct
14 Correct 112 ms 5880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 65 ms 3192 KB Output is correct
7 Correct 82 ms 3448 KB Output is correct
8 Correct 110 ms 5880 KB Output is correct
9 Correct 107 ms 5752 KB Output is correct
10 Correct 113 ms 5752 KB Output is correct
11 Correct 115 ms 5752 KB Output is correct
12 Correct 108 ms 5752 KB Output is correct
13 Correct 102 ms 5752 KB Output is correct
14 Correct 112 ms 5880 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Incorrect 0 ms 256 KB Output isn't correct
18 Halted 0 ms 0 KB -