Submission #303319

# Submission time Handle Problem Language Result Execution time Memory
303319 2020-09-20T07:59:13 Z Utaha Comparing Plants (IOI20_plants) C++14
0 / 100
1 ms 384 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) {
	n = r.size();
	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;
	// cout<<idx<<' '<<l<<' '<<r<<endl;
	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 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 0 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 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Incorrect 0 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -