Submission #1043187

# Submission time Handle Problem Language Result Execution time Memory
1043187 2024-08-04T04:10:20 Z thinknoexit Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 348 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
int ord[5050];
void init(int k, vector<int> r) {
	n = r.size();
	memset(ord, -1, sizeof ord);
	for (int i = 0;i < n;i++) {
		vector<int> v;
		for (int j = 0;j < n;j++) {
			if (ord[j] == -1 && r[j] == 0) {
				v.push_back(j);
			}
		}
		int idx = 0;
		for (int j = 0;j < (int)v.size();j++) {
			if ((v[j] - v[(j + n - 1) % n] + n) % n >= k) idx = v[j];
		}
		ord[idx] = i;
		for (int j = 1;j < k;j++) {
			r[(idx - j + n) % n]--;
		}
	}
}

int compare_plants(int x, int y) {
	return (ord[x] > ord[y]) ? 1 : -1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -