Submission #817310

# Submission time Handle Problem Language Result Execution time Memory
817310 2023-08-09T11:24:38 Z jlallas384 Comparing Plants (IOI20_plants) C++17
0 / 100
40 ms 4908 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> ans;
void init(int k, std::vector<int> r) {
	int n = r.size();
	ans.resize(n);
	for(int val = n - 1; val >= 0; val--){
		int bst = -1;
		for(int i = 0; i < n; i++){
			if(r[i] == 0){
				bst = i;
			}
		}
		ans[bst] = val;
		r[bst] = 1e9;
		for(int i = 1; i < k; i++){
			int id = (bst - i + n) % n;
			r[id] = max(r[id] - 1, 0);
		}
	}
}

int compare_plants(int x, int y) {
	if(ans[x] > ans[y]) return 1;
	else return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 304 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Incorrect 40 ms 4908 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 304 KB Output isn't correct
5 Halted 0 ms 0 KB -