답안 #1023171

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023171 2024-07-14T11:40:03 Z Mr_Ph 식물 비교 (IOI20_plants) C++17
5 / 100
73 ms 8048 KB
#include "plants.h"
#include <bits/stdc++.h>
// #include "grader.cpp"
using namespace std;
vector<int>pref;
int N;
int get(int l,int r)
{
	if(l<=r)
		return pref[r]-(l?pref[l-1]:0);
	else
		return pref[N-1]-(l?pref[l-1]:0)+pref[r];
}
void init(int k, std::vector<int> r) {
	N=r.size();
	pref.resize(N);
	pref[0]=r[0];
	for(int i=1;i<N;i++)
		pref[i]=pref[i-1]+r[i];
}

int compare_plants(int x, int y) {
	int l=x,r=y-1;
	int r1=(x==0?N-1:x-1),l1=y;
	if(get(l,r)==0)return 1;
	if(get(l1,r1)==(r1>=l1?r1-l1+1:N-l1+r1+1))return 1;
	if(get(l,r)==(r-l)+1)return -1;
	if(get(l1,r1)==0)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 34 ms 4060 KB Output is correct
7 Correct 47 ms 5420 KB Output is correct
8 Correct 57 ms 8020 KB Output is correct
9 Correct 53 ms 8016 KB Output is correct
10 Correct 73 ms 7908 KB Output is correct
11 Correct 49 ms 8016 KB Output is correct
12 Correct 48 ms 8016 KB Output is correct
13 Correct 51 ms 8016 KB Output is correct
14 Correct 48 ms 8048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 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 Incorrect 0 ms 348 KB Output isn't correct
3 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 1 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 0 ms 348 KB Output is correct
3 Correct 0 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 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 34 ms 4060 KB Output is correct
7 Correct 47 ms 5420 KB Output is correct
8 Correct 57 ms 8020 KB Output is correct
9 Correct 53 ms 8016 KB Output is correct
10 Correct 73 ms 7908 KB Output is correct
11 Correct 49 ms 8016 KB Output is correct
12 Correct 48 ms 8016 KB Output is correct
13 Correct 51 ms 8016 KB Output is correct
14 Correct 48 ms 8048 KB Output is correct
15 Correct 1 ms 348 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 -