답안 #1041767

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041767 2024-08-02T07:53:26 Z MarwenElarbi 식물 비교 (IOI20_plants) C++17
0 / 100
31 ms 4692 KB
#include <bits/stdc++.h>
#include "plants.h"
using namespace std;
const int nax=2e5+5;
int mx[nax];
int mn[nax];
void init(int k, std::vector<int> r) {
	int n=r.size();
	for (int i = 0; i < n; ++i)
	{
		mx[i]=i;
		mn[i]=i;
	}
	for (int i = 0; i < n; ++i)
	{
		if(r[i]==0){
			mn[(i+1)%n]=mn[i];
		}else{
			mx[(i+1)%n]=mx[i];
		}
	}
	return;
}

int compare_plants(int x, int y) {
	if(mx[y]<=x){
		return -1;
	}else if(mn[y]<=x){
		return 1;
	}else if(mx[x]>x&&mx[x]<=y){
		return 1;
	}else if(mn[x]>x&&mn[x]<=y){
		return -1;
	}else return 0;
}
# 결과 실행 시간 메모리 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 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 27 ms 3852 KB Output is correct
7 Incorrect 31 ms 4692 KB Output isn't correct
8 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 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 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 0 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 Correct 0 ms 348 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 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 27 ms 3852 KB Output is correct
7 Incorrect 31 ms 4692 KB Output isn't correct
8 Halted 0 ms 0 KB -