Submission #397241

# Submission time Handle Problem Language Result Execution time Memory
397241 2021-05-01T18:27:35 Z Antekb Comparing Plants (IOI20_plants) C++14
0 / 100
4 ms 588 KB
#include "plants.h"
#include<bits/stdc++.h>
#define pb(x) push_back(x)
using namespace std;
vector<int> V, V2;
void init(int k, std::vector<int> r) {
	int n=r.size();
	k--;
	V.resize(n);
	auto r2=r;
	for(int i=0; i<n; i++){
		vector<int> V2;
		for(int j=0; j<n; j++){
			if(r2[j]==k){
				V2.push_back(j);
			}
		}
		int j=V2[0];
		bool b=1;
		for(int l=1; l<=k; l++){
			if(r2[(j-l+n)%n]++==k)b=0;
		}
		if(!b){
			for(int l=1; l<=k; l++){
				r2[(j-l+n)%n]--;
			}
			j=V2[1];
			b=1;
			for(int l=1; l<=k; l++){
				if(r2[(j-l+n)%n]++==k)b=0;
			}
			assert(b);
		}
		V[j]=i;
		r2[j]=-1;
	}
	return;
}

int compare_plants(int x, int y){
	if(V[x]<V[y])return -1;
	if(V[x]>V[y])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 Runtime error 1 ms 332 KB Execution killed with signal 6
4 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 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Runtime error 4 ms 588 KB Execution killed with signal 6
7 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 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Runtime error 4 ms 588 KB Execution killed with signal 6
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 1 ms 332 KB Execution killed with signal 6
3 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 Incorrect 1 ms 204 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 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 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 Correct 1 ms 204 KB Output is correct
3 Runtime error 1 ms 332 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -