Submission #400152

# Submission time Handle Problem Language Result Execution time Memory
400152 2021-05-07T13:12:48 Z kwongweng Comparing Plants (IOI20_plants) C++17
5 / 100
120 ms 8664 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define F first
#define S second
ll INF = 1000000000;

const int N = 200001;
vi r, sum;
int n, k;
void init(int K, vi R) {
	n = R.size();
	r.resize(n); sum.resize(n+1);
	FOR(i, 0, n) r[i] = R[i];
	k = K;
	FOR(i, 1, n+1){
	    sum[i] = sum[i-1] + r[i-1];
	}
	
}

int compare_plants(int x, int y) {
    if (sum[y] - sum[x] == 0 || sum[x] + sum[n] - sum[y] == n + x - y) return 1;
    if (sum[y] - sum[x] == y - x || sum[x] + sum[n] - sum[y] == 0) return -1;
	return 0;
}
# 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 296 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 59 ms 4048 KB Output is correct
7 Correct 91 ms 5540 KB Output is correct
8 Correct 120 ms 8664 KB Output is correct
9 Correct 92 ms 8664 KB Output is correct
10 Correct 92 ms 8644 KB Output is correct
11 Correct 98 ms 8648 KB Output is correct
12 Correct 101 ms 8636 KB Output is correct
13 Correct 107 ms 8664 KB Output is correct
14 Correct 93 ms 8660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Incorrect 1 ms 224 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Incorrect 1 ms 224 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 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 300 KB Output is correct
4 Incorrect 1 ms 296 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 208 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 1 ms 296 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 59 ms 4048 KB Output is correct
7 Correct 91 ms 5540 KB Output is correct
8 Correct 120 ms 8664 KB Output is correct
9 Correct 92 ms 8664 KB Output is correct
10 Correct 92 ms 8644 KB Output is correct
11 Correct 98 ms 8648 KB Output is correct
12 Correct 101 ms 8636 KB Output is correct
13 Correct 107 ms 8664 KB Output is correct
14 Correct 93 ms 8660 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 292 KB Output is correct
17 Incorrect 1 ms 224 KB Output isn't correct
18 Halted 0 ms 0 KB -