Submission #19150

#TimeUsernameProblemLanguageResultExecution timeMemory
19150suhgyuho_william라멘 (JOI14_ramen)C++98
100 / 100
0 ms1124 KiB
#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 (stderr)


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...