Submission #1043188

# Submission time Handle Problem Language Result Execution time Memory
1043188 2024-08-04T04:12:39 Z thinknoexit Comparing Plants (IOI20_plants) C++17
0 / 100
32 ms 3152 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 = n;i >= 1;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 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 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 32 ms 3152 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -