Submission #412685

# Submission time Handle Problem Language Result Execution time Memory
412685 2021-05-27T10:41:11 Z dynam1c Comparing Plants (IOI20_plants) C++17
5 / 100
107 ms 6084 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define all(x) x.begin(),x.end()

int n, k;
vector<int> r;
vector<int> pref;

void init(int K, std::vector<int> R) {
	k = K, r = R;
	n = r.size();
	pref.resize(n+1);
	for (int i = 0; i < n; i++)
		pref[i+1] = pref[i] + r[i];
	return;
}

int compare_plants(int x, int y) {
	if (x > y)
		return -compare_plants(y, x);
	if (pref[y]-pref[x] == y-x or pref[x] + pref[n] - pref[y] == 0)
		return -1;
	if (pref[y]-pref[x] == 0 or pref[x] + pref[n] - pref[y] == n-(y-x))
		return 1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 56 ms 3292 KB Output is correct
7 Correct 68 ms 3700 KB Output is correct
8 Correct 92 ms 5980 KB Output is correct
9 Correct 107 ms 5984 KB Output is correct
10 Correct 87 ms 5960 KB Output is correct
11 Correct 88 ms 5984 KB Output is correct
12 Correct 86 ms 6084 KB Output is correct
13 Correct 83 ms 5948 KB Output is correct
14 Correct 90 ms 5956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 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 1 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Incorrect 1 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 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 56 ms 3292 KB Output is correct
7 Correct 68 ms 3700 KB Output is correct
8 Correct 92 ms 5980 KB Output is correct
9 Correct 107 ms 5984 KB Output is correct
10 Correct 87 ms 5960 KB Output is correct
11 Correct 88 ms 5984 KB Output is correct
12 Correct 86 ms 6084 KB Output is correct
13 Correct 83 ms 5948 KB Output is correct
14 Correct 90 ms 5956 KB Output is correct
15 Correct 1 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 -