Submission #331978

# Submission time Handle Problem Language Result Execution time Memory
331978 2020-11-30T21:51:36 Z pggp Comparing Plants (IOI20_plants) C++14
0 / 100
4000 ms 492 KB
#include <bits/stdc++.h>

using namespace std;

int K;
vector < int > R;
int n;
vector < int > order;
int ord;

void init(int k, vector < int > r){
	K = k;
	R = r;
	n = R.size();
	order.resize(n);

	for (int i = 0; i < n; ++i)
	{
		for(int ind = 0; ind < n; ind++){
			if(R[ind] == 0){
				bool b = false;
				for(int c = 0; c < k; c++){
					if(R[(ind - c + n) % n] == 0){
						b = true;
						ind = (ind - c + n) % n - 1;
						break;
					}
				}
				if(b){
					continue;
				}
				for(int c = 0; c < k; c++){
					R[(ind - c + n) % n]--;
				}
				order[ind] = ord;
				//cout << ind << " ";
				ord++;
				break;
			}
		}
	}
}

int compare_plants(int x, int y){
	if(order[x] < order[y]){
		return 1;
	}
	if(order[y] < order[x]){
		return -1;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4006 ms 416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4083 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4083 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4089 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4053 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4006 ms 416 KB Time limit exceeded
2 Halted 0 ms 0 KB -