답안 #300477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300477 2020-09-17T07:54:16 Z Muhammetali 식물 비교 (IOI20_plants) C++11
0 / 100
66 ms 5532 KB
#include "plants.h"
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
using namespace std;
int res[10001];
int n;
void init(int k, std::vector<int> r) {
	n=sz(r);
	for (int i=0;i<sz(r);i++)res[i]=r[i];
	return;
}

int compare_plants(int x, int y) {
	bool b=0;
	int k=res[x];
	for (int i=x+1;i<y;i++)
	{
		if (res[i]!=k)
		{
			b=1;
			break;
		}
	}
	if (b==0)
	{
		if (k==0)return 1;
		else return -1;
	}
	b=0;
	k=res[y];
	while(y!=x)
	{
		if (res[y]!=k)
		{
			b=1;
			break;
		}
		y++;
		if (y==n)y=0;
	}
	if (!b)
	{
		if (k==1)return 1;
		else return -1;
	}
	return 0;
}
# 결과 실행 시간 메모리 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 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 66 ms 3192 KB Output is correct
7 Runtime error 65 ms 5532 KB Execution killed with signal 11
8 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 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 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 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 1 ms 384 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 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 66 ms 3192 KB Output is correct
7 Runtime error 65 ms 5532 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -