Submission #300504

# Submission time Handle Problem Language Result Execution time Memory
300504 2020-09-17T08:14:52 Z Dovran Comparing Plants (IOI20_plants) C++11
5 / 100
107 ms 5052 KB
#include <bits/stdc++.h>
#define N 200009
#define pii pair <int, int>
#define ff first
#define sz() size()
#define ss second
#define sz() size()
#define pb push_back
#define ll long long

using namespace std;

int v[N], n;

void init(int k, vector<int>r){
	n=r.sz();
	for(int i=0; i<n; i++)
		v[i]=r[i]+v[i-1];
}

int compare_plants(int x, int y){
	if(x>y)
		swap(x, y);
	
	if(v[y-1]-v[x-1]==0 or (v[x-1]+v[n-1]-v[y-1]==x+n-y))
		return 1;
	else if(v[y-1]-v[x-1]==y-x or (v[x-1]==0 and v[n-1]-v[y-1]==0))
		return -1;
		
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 61 ms 3192 KB Output is correct
7 Correct 87 ms 3448 KB Output is correct
8 Correct 107 ms 4984 KB Output is correct
9 Correct 103 ms 4984 KB Output is correct
10 Correct 105 ms 5036 KB Output is correct
11 Correct 103 ms 4984 KB Output is correct
12 Correct 102 ms 5052 KB Output is correct
13 Correct 96 ms 4984 KB Output is correct
14 Correct 102 ms 4984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Incorrect 1 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 1 ms 384 KB Output is correct
3 Incorrect 1 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 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 61 ms 3192 KB Output is correct
7 Correct 87 ms 3448 KB Output is correct
8 Correct 107 ms 4984 KB Output is correct
9 Correct 103 ms 4984 KB Output is correct
10 Correct 105 ms 5036 KB Output is correct
11 Correct 103 ms 4984 KB Output is correct
12 Correct 102 ms 5052 KB Output is correct
13 Correct 96 ms 4984 KB Output is correct
14 Correct 102 ms 4984 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Incorrect 1 ms 256 KB Output isn't correct
18 Halted 0 ms 0 KB -