답안 #300507

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300507 2020-09-17T08:16:45 Z Batyr 식물 비교 (IOI20_plants) C++17
5 / 100
107 ms 5112 KB
#include<bits/stdc++.h>
#include "plants.h"
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define sz(a) (int)a.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const ll inf=1e18;
const int mod=1e9+7;
const int maxn=2e5+5;

int n,del;
int p[maxn];

void init(int k, vector<int>r){
	n = sz(r);
	p[0] = r[0];
	for(int i = 1;i < n;i++) p[i] = p[i-1] + r[i];
}

int compare_plants(int x,int y){
	
	if(x==0) del = 0;
	else del = p[x-1];
	
	if(p[y-1] - del == 0) return 1;
	if(p[y-1] - del == y - x) return -1;
	
	int sum = p[n-1] - p[y-1] + del;
	if(sum == 0) return -1;
	if(sum == (n - y) + x) return 1;
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 62 ms 3192 KB Output is correct
7 Correct 82 ms 3552 KB Output is correct
8 Correct 105 ms 5112 KB Output is correct
9 Correct 101 ms 4984 KB Output is correct
10 Correct 107 ms 4984 KB Output is correct
11 Correct 107 ms 4984 KB Output is correct
12 Correct 101 ms 5112 KB Output is correct
13 Correct 99 ms 4984 KB Output is correct
14 Correct 102 ms 4984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 62 ms 3192 KB Output is correct
7 Correct 82 ms 3552 KB Output is correct
8 Correct 105 ms 5112 KB Output is correct
9 Correct 101 ms 4984 KB Output is correct
10 Correct 107 ms 4984 KB Output is correct
11 Correct 107 ms 4984 KB Output is correct
12 Correct 101 ms 5112 KB Output is correct
13 Correct 99 ms 4984 KB Output is correct
14 Correct 102 ms 4984 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Incorrect 1 ms 256 KB Output isn't correct
18 Halted 0 ms 0 KB -