Submission #817272

# Submission time Handle Problem Language Result Execution time Memory
817272 2023-08-09T11:11:51 Z jlallas384 Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 468 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]--;
			assert(r[(bst - i + n) % n] >= 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Runtime error 1 ms 340 KB Execution killed with signal 6
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 Runtime error 1 ms 340 KB Execution killed with signal 6
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 Runtime error 1 ms 340 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 340 KB Execution killed with signal 6
3 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 Runtime error 1 ms 468 KB Execution killed with signal 6
4 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 Runtime error 1 ms 340 KB Execution killed with signal 6
4 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 1 ms 212 KB Output is correct
4 Runtime error 1 ms 340 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -