답안 #1081972

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1081972 2024-08-30T13:33:15 Z wood 식물 비교 (IOI20_plants) C++17
14 / 100
4000 ms 8784 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>

vi ranking;

void init(int k, std::vector<int> r) {
	k--;
	int n = r.size();
	ranking.resize(n);
	for(int i = 0; i<n; i++) {
		int window = 0;
		for(int l = 0;l<k; l++){
			window+=(r[l]==0);
		}
		int j;
		for(j = k; j<n+k; j++){
			int pos = j%n;
			if(r[pos]==0&&window==0) goto found;
			window-=r[j-k]==0;
			window+=(r[pos]==0);
		}
		found:
			for(int l = 1; l<=k; l++){if(r[(j-l+n)%n]>0) r[(j-l+n)%n]--;}
			r[j%n]=INT_MIN;
			ranking[j%n] = i;
	}
}

int compare_plants(int x, int y) {
	if(ranking[x]<ranking[y]) return 1;
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 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 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 107 ms 4984 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 111 ms 5204 KB Output is correct
11 Correct 97 ms 4972 KB Output is correct
12 Correct 89 ms 5204 KB Output is correct
13 Correct 122 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 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 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 107 ms 4984 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 111 ms 5204 KB Output is correct
11 Correct 97 ms 4972 KB Output is correct
12 Correct 89 ms 5204 KB Output is correct
13 Correct 122 ms 5204 KB Output is correct
14 Correct 1060 ms 5716 KB Output is correct
15 Execution timed out 4099 ms 8784 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 38 ms 4792 KB Output is correct
4 Execution timed out 4022 ms 8020 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 432 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 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -