Submission #451957

# Submission time Handle Problem Language Result Execution time Memory
451957 2021-08-03T14:08:17 Z rainboy Comparing Plants (IOI20_plants) C++17
5 / 100
107 ms 8008 KB
#include "plants.h"

using namespace std;

typedef vector<int> vi;

const int N = 200000;

int pp[N], n, k;

void init(int k_, vi rr) {
	int i;

	n = rr.size(), k = k_;
	for (i = 0; i < n; i++)
		pp[i] = rr[i];
	for (i = 1; i < n; i++)
		pp[i] += pp[i - 1];
}

int compare_plants(int x, int y) {
	int k = pp[y - 1] - (x == 0 ? 0 : pp[x - 1]);

	if (k == y - x)
		return -1;
	else if (k == 0)
		return 1;
	k = pp[n - 1] - k;
	if (k == n - (y - x))
		return 1;
	else if (k == 0)
		return -1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 74 ms 4004 KB Output is correct
7 Correct 74 ms 5416 KB Output is correct
8 Correct 97 ms 7892 KB Output is correct
9 Correct 98 ms 7884 KB Output is correct
10 Correct 95 ms 7872 KB Output is correct
11 Correct 96 ms 7896 KB Output is correct
12 Correct 98 ms 7884 KB Output is correct
13 Correct 98 ms 8008 KB Output is correct
14 Correct 107 ms 7876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 74 ms 4004 KB Output is correct
7 Correct 74 ms 5416 KB Output is correct
8 Correct 97 ms 7892 KB Output is correct
9 Correct 98 ms 7884 KB Output is correct
10 Correct 95 ms 7872 KB Output is correct
11 Correct 96 ms 7896 KB Output is correct
12 Correct 98 ms 7884 KB Output is correct
13 Correct 98 ms 8008 KB Output is correct
14 Correct 107 ms 7876 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Incorrect 1 ms 204 KB Output isn't correct
18 Halted 0 ms 0 KB -