답안 #984082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
984082 2024-05-16T09:56:52 Z phoenix0423 식물 비교 (IOI20_plants) C++17
5 / 100
67 ms 10316 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define pb push_back
#define eb emplace_back
const int maxn = 4e5 + 5;
const int INF = 1e9;
#include "plants.h"
int a[maxn];
int n, k;
vector<int> r;

void init(int _k, std::vector<int> _r) {
	r = _r, k = _k;
	n = r.size();
	for(auto x : _r) r.pb(x);
	for(int i = 0; i < 2 * n; i++) a[i] = 1 - r[i] * 2;
	for(int i = 1; i < 2 * n; i++) a[i] += a[i - 1];
}

int compare_plants(int x, int y) {\
	int m = a[y - 1] - (x ? a[x - 1] : 0);
	if(m == y - x) return 1;
	if(m == x - y) return -1;
	x += n;
	m = a[x - 1] - a[y - 1];
	if(m == x - y) return -1;
	if(m == y - x) return 1;
	return 0;
}
# 결과 실행 시간 메모리 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 37 ms 3040 KB Output is correct
7 Correct 42 ms 3736 KB Output is correct
8 Correct 56 ms 7420 KB Output is correct
9 Correct 56 ms 10304 KB Output is correct
10 Correct 56 ms 10304 KB Output is correct
11 Correct 67 ms 10304 KB Output is correct
12 Correct 55 ms 10316 KB Output is correct
13 Correct 54 ms 10316 KB Output is correct
14 Correct 53 ms 10308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 500 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 500 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 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 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 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 1 ms 500 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 37 ms 3040 KB Output is correct
7 Correct 42 ms 3736 KB Output is correct
8 Correct 56 ms 7420 KB Output is correct
9 Correct 56 ms 10304 KB Output is correct
10 Correct 56 ms 10304 KB Output is correct
11 Correct 67 ms 10304 KB Output is correct
12 Correct 55 ms 10316 KB Output is correct
13 Correct 54 ms 10316 KB Output is correct
14 Correct 53 ms 10308 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -