Submission #817269

# Submission time Handle Problem Language Result Execution time Memory
817269 2023-08-09T11:10:43 Z jlallas384 Comparing Plants (IOI20_plants) C++17
0 / 100
43 ms 4936 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 mn = 1e9, bst = -1;
		for(int i = 0; i < n; i++){
			if(mn > r[i]){
				mn = r[i];
				bst = i;
			}
		}
		ans[bst] = val;
		r[bst] = 1e9;
		for(int i = 1; i < k; i++){
			r[(bst - i + n) % n]--;
		}
	}
}

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 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Incorrect 0 ms 212 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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 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 300 KB Output is correct
3 Incorrect 43 ms 4936 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 1 ms 300 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 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 300 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 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -