답안 #1078131

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078131 2024-08-27T13:07:09 Z mindiyak 식물 비교 (IOI20_plants) C++14
0 / 100
4000 ms 8020 KB
#include "plants.h"
#include <iostream>
using namespace std;

vector<int> R;

void init(int k, std::vector<int> r) {
	R = r;
	return;
}

int compare_plants(int x, int y) {
	int a=x;
	int n = R.size();
	// cerr << x << " " << y << endl;

	a = x;
	if(R[a] == 0){
		a += 1;
		while((a%n) != y && R[(a%n)] == 0)a++;
		// cerr << "X - " << (a%n) << " -1" << endl;
		if((a%n) == y) return 1;
	}
	a = y;
	if(R[a] == 1){
		a += 1;
		while((a%n) != x && R[(a%n)] == 1)a++;
		// cerr << "X - " << (a%n) << " -1" << endl;
		if((a%n) == x) return 1;
	}


	a = y;
	if(R[a] == 0){
		a += 1;
		while((a%n) != x && R[(a%n)] == 0)a++;
		// cerr << "X - " << (a%n) << " -1" << endl;
		if((a%n) == x) return -1;
	}
	a = x;
	if(R[a] == 1){
		a += 1;
		while((a%n) != y && R[(a%n)] == 1)a++;
		// cerr << "X - " << (a%n) << " -1" << endl;
		if((a%n) == y) return -1;
	}
	
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 36 ms 4028 KB Output is correct
7 Correct 107 ms 5460 KB Output is correct
8 Correct 73 ms 8020 KB Output is correct
9 Correct 118 ms 8016 KB Output is correct
10 Correct 635 ms 8020 KB Output is correct
11 Execution timed out 4035 ms 8016 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 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 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 36 ms 4028 KB Output is correct
7 Correct 107 ms 5460 KB Output is correct
8 Correct 73 ms 8020 KB Output is correct
9 Correct 118 ms 8016 KB Output is correct
10 Correct 635 ms 8020 KB Output is correct
11 Execution timed out 4035 ms 8016 KB Time limit exceeded
12 Halted 0 ms 0 KB -