Submission #19150

# Submission time Handle Problem Language Result Execution time Memory
19150 2016-02-19T04:48:47 Z suhgyuho_william 라멘 (JOI14_ramen) C++
100 / 100
0 ms 1124 KB
#include "ramen.h"

bool check[410];

void Ramen(int N) {
	int i;
	int ansx,ansy;

	if(N == 1){
		Answer(0,0);
		return;
	}
	for(i=0; i+1<N; i+=2){
		if(Compare(i,i+1) == 1) check[i] = true;
		else check[i+1] = true;
	}
	if(check[0]) ansy = 0;
	else ansy = 1;
	if(N%2 == 1) check[N-1] = true;
	for(i=2; i<N; i++){
		if(!check[i]) continue;
        if(Compare(ansy,i) == -1) ansy = i;
	}
	if(N%2 == 1) check[N-1] = false;
	if(!check[0]) ansx = 0;
	else ansx = 1;
	for(i=2; i<N; i++){
		if(check[i]) continue;
		if(Compare(ansx,i) == 1) ansx = i;
	}
	Answer(ansx,ansy);
}

Compilation message


# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct