답안 #1045317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1045317 2024-08-05T20:20:00 Z mariaclara 식물 비교 (IOI20_plants) C++17
14 / 100
4000 ms 9556 KB
#include "plants.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

vector<int> h;
void init(int k, vector<int> r) {
	int n = sz(r);
	h.resize(n);
	
	for(int i = 0; i < n; i++) r.pb(r[i]);

	for(int t = n; t >= 1; t--) {
		vector<int> to_erase;

		for(int i = 0, last = -k; i < 2*n; i++) {
			if(r[i] != 0) continue;
			if(i < n) { last = i; continue; }
			if(i - last >= k) to_erase.pb(i);
			last = i;
		}

		if(to_erase.empty()) break;

		for(int x : to_erase) {
			h[x%n] = t;
			for(int i = x; i > x-k; i--) 
				r[i%n]--, r[i%n + n]--;
		}
	}

	return;
}

int compare_plants(int x, int y) {
	if(h[x] > h[y]) return 1;
	if(h[x] < h[y]) return -1;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 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 348 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 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 90 ms 5024 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 89 ms 5224 KB Output is correct
11 Correct 83 ms 4944 KB Output is correct
12 Correct 93 ms 5200 KB Output is correct
13 Correct 98 ms 5216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 90 ms 5024 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 89 ms 5224 KB Output is correct
11 Correct 83 ms 4944 KB Output is correct
12 Correct 93 ms 5200 KB Output is correct
13 Correct 98 ms 5216 KB Output is correct
14 Correct 819 ms 5488 KB Output is correct
15 Execution timed out 4062 ms 9556 KB Time limit exceeded
16 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 Correct 36 ms 4796 KB Output is correct
4 Execution timed out 4065 ms 8676 KB Time limit exceeded
5 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 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 348 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 348 KB Output isn't correct
5 Halted 0 ms 0 KB -