답안 #1020519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1020519 2024-07-12T06:27:02 Z alex_2008 식물 비교 (IOI20_plants) C++14
14 / 100
4000 ms 9552 KB
#include "plants.h"
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const int N = 2e5 + 10;
int r[N], perm[N];
int val[N];
int n, k;
void init(int K, vector<int> R) {
	k = K;
	n = (int)R.size();
	for (int i = 1; i <= n; i++) {
		r[i] = R[i - 1];
	}
	for (int i = n; i >= 1; i--) {
		int last = -1;
		for (int j = 1; j <= n; j++) {
			if (r[j] != 0) continue;
			if (last == -1 || (last + (k - 1) < j)) last = j;
		}
		r[last] = -1;
		perm[last] = i;
		for (int l = max(1, (last - k + 1)); l < last; l++) {
			r[l]--;
		}
		if ((last - k + 1) < 1) {
			int mnac = (k - 1) - (last - 1);
			for (int l = n; l > n - mnac; l--) {
				r[l]--;
			}
		}
	}
}
int compare_plants(int x, int y) {
  	x++; y++;
	if (perm[x] > perm[y]) return 1;
	return -1;
}
/*
int main() {
	init(3, { 2, 1, 0, 2, 1 });
	for (int i = 1; i <= 5; i++) {
		cout << perm[i] << " ";
	}
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 440 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 50 ms 5204 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 49 ms 5040 KB Output is correct
11 Correct 53 ms 4948 KB Output is correct
12 Correct 51 ms 5200 KB Output is correct
13 Correct 51 ms 5020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 50 ms 5204 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 49 ms 5040 KB Output is correct
11 Correct 53 ms 4948 KB Output is correct
12 Correct 51 ms 5200 KB Output is correct
13 Correct 51 ms 5020 KB Output is correct
14 Correct 254 ms 5588 KB Output is correct
15 Execution timed out 4009 ms 9552 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 33 ms 5044 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 440 KB Output isn't correct
5 Halted 0 ms 0 KB -