Submission #397235

# Submission time Handle Problem Language Result Execution time Memory
397235 2021-05-01T18:24:11 Z Antekb Comparing Plants (IOI20_plants) C++14
0 / 100
2 ms 332 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];
		if(V2.size()==2){
			if(((V2[1]-V2[0]+n)%n)>k)j=V2[1];
		}
		V[j]=i;
		r2[j]=-1;
		for(int l=1; l<=k; l++){
			r2[(j-l+n)%n]++;
		}
	}
	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 11
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 Runtime error 2 ms 332 KB Execution killed with signal 11
6 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 Runtime error 2 ms 332 KB Execution killed with signal 11
6 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 11
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 11
4 Halted 0 ms 0 KB -