답안 #789701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
789701 2023-07-21T19:18:45 Z FEDIKUS 식물 비교 (IOI20_plants) C++17
0 / 100
1 ms 308 KB
#include "plants.h"
#include<bits/stdc++.h>

using namespace std;

const int maxn=2e5+10;

int n;
int sled[maxn]; // 1 = veci
int pref[maxn];
int uk=0;

void init(int k, vector<int> r) {
	n=r.size();
	for(int i=0;i<n;i++){
		if(r[i]==1) sled[i]=1;
		if(i>0) pref[i]=pref[i-1];
		pref[i]+=sled[i];
		uk+=sled[i];
	}
	return;
}

int qry(int l,int r){
	return pref[r]-(l>0 ? pref[l-1]:0);
}

int compare_plants(int x, int y){
	if(qry(x,y-1)==y-x) return -1;
	int ostalo=uk-qry(x,y-1);
	if(ostalo==n-y+x) return 1;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -