답안 #300498

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300498 2020-09-17T08:11:08 Z Dovran 식물 비교 (IOI20_plants) C++11
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
#define N 200009
#define pii pair <int, int>
#define ff first
#define sz() size()
#define ss second
#define sz() size()
#define pb push_back
#define ll long long

using namespace std;

int v[N], n;

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

int compare_plants(int x, int y){
	if(x>y)
		swap(x, y);
	
	if(v[y-1]-v[x-1]==0 or (v[x-1]+v[n-1]-v[y-1]==x+n-y+1))
		return 1;
	else if(v[y-1]-v[x-1]==y-x or (v[x-1]==0 and v[n-1]-v[y-1]==0))
		return -1;
		
	return 0;
}
# 결과 실행 시간 메모리 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 0 ms 256 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 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 Incorrect 1 ms 288 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -