Submission #369748

# Submission time Handle Problem Language Result Execution time Memory
369748 2021-02-22T11:18:03 Z MilosMilutinovic Comparing Plants (IOI20_plants) C++14
0 / 100
1 ms 364 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;

int n, k;
vector<int> a;

int compare_plants(int x, int y) {
	if(x==n-1) {
		if(y==x-1) {
			if(a[y])
				return -1;
			return 1;
		} else {
			if(y!=0)
				return 0;
			if(a[x])
				return 1;
			return -1;
		}
	} else {
		if(x==0) {
			if(y==n-1) {
				if(a[y])
					return -1;
				return 1;
			} else {
				if(y!=1)
					return 0;
				if(a[x])
					return 1;
				return -1;
			}
		} else {
			if(abs(x-y)!=1)
				return 0;
			if(x<y) {
				if(a[x])
					return 1;
				return -1;
			} else {
				if(a[y])
					return -1;
				return 1;
			}
		}
	}
}

void init(int K, vector<int> r) {
	n=(int)r.size(), k=K, a=r;
}

/*int main() {

	return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -