Submission #303315

# Submission time Handle Problem Language Result Execution time Memory
303315 2020-09-20T07:55:27 Z Utaha Comparing Plants (IOI20_plants) C++14
0 / 100
1 ms 256 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<int> v;

void init(int _k, std::vector<int> r) {
	v = r;
	k = _k;
	return;
}

bool between(int idx,int l,int r){
	if(l<=idx&&idx<r) return 1;
	if(l<=idx+n&&idx+n<r) return 1;
	return 0;
}

int compare_plants(int x, int y) {
	if(between(y,x,x+k)){
		if(v[x]==0) return 1;
		else if(v[x] == k-1) return -1;
	}
	if(between(x,y,y+k)){
		if(v[y]==0) return -1;
		else if(v[y] == k-1) return 1;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 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 Incorrect 0 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 Incorrect 0 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 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -