Submission #300562

# Submission time Handle Problem Language Result Execution time Memory
300562 2020-09-17T09:35:53 Z glikcakbn Comparing Plants (IOI20_plants) C++14
5 / 100
107 ms 4988 KB
#include "plants.h"

using namespace std;

int N;
vector<int> ps;

void init(int k, vector<int> r)
{
	N = r.size();
    ps.resize(N + 1);
    for(int i = 0; i < N; ++i) ps[i + 1] = ps[i] + r[i];
}

int compare_plants(int x, int y)
{
	int t = ps[y] - ps[x];
	if(t == 0) return 1;
	else if(t == y - x) return -1;
	t = ps[N] - t;
	if(t == 0) return -1;
	else if(t == N - y + x) return 1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 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 64 ms 3192 KB Output is correct
7 Correct 82 ms 3320 KB Output is correct
8 Correct 107 ms 4984 KB Output is correct
9 Correct 105 ms 4984 KB Output is correct
10 Correct 104 ms 4984 KB Output is correct
11 Correct 106 ms 4988 KB Output is correct
12 Correct 103 ms 4984 KB Output is correct
13 Correct 100 ms 4984 KB Output is correct
14 Correct 106 ms 4984 KB Output is correct
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 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 64 ms 3192 KB Output is correct
7 Correct 82 ms 3320 KB Output is correct
8 Correct 107 ms 4984 KB Output is correct
9 Correct 105 ms 4984 KB Output is correct
10 Correct 104 ms 4984 KB Output is correct
11 Correct 106 ms 4988 KB Output is correct
12 Correct 103 ms 4984 KB Output is correct
13 Correct 100 ms 4984 KB Output is correct
14 Correct 106 ms 4984 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 -