Submission #551

# Submission time Handle Problem Language Result Execution time Memory
551 2013-02-28T13:00:06 Z kriii 쉬운 문제 (GA3_easy) C++
Compilation error
0 ms 0 KB
#include "grader.h"

int B[110],end[110];

void Remark(int s, int e)
{
	int i;

	for (i=s;i<e;i++) if (B[i]) Mark(i,B[i]);
}

void GetBestAnswer (int N, int *S, int K)
{
	int i,j,now;

	for (i=0;i<N;i++) B[i] = 0, end[i] = 0;

	for (i=0;i<N;i+=2){
		for (j=1;j<5;j++){
			if (end[i] && end[i+1]) break;
			if (!end[i]) B[i] = j;
			if (!end[i+1]) B[i+1] = j;

			Remark(i,i+2); K--;
			now = GetScore();
			if (S[i] != S[i+1]){
				if (now == 0) continue;
				else if (now == S[i]) end[i] = 1;
				else if (now == S[i+1]) end[i+1] = 1;
				else end[i] = end[i+1] = 1;
			}
			else{
				if (now == 0) continue;
				else if (now == S[i]){
					if (end[i] || end[i+1]){
						if ((N - i) / 2 * 5 >= K){j++; break;}
						continue;
					}

					B[i] = j+1;
					Remark(i,i+2); K--;
					now = GetScore();
					if (now == 0){
						B[i] = j; end[i] = 1;
					}
					else if (now == S[i]){
						B[i+1] = j; end[i+1] = 1;
						j++;
					}
					else{
						end[i] = end[i+1] = 1;
					}
				}
				else end[i] = end[i+1] = 1;
			}
		}
		if (!end[i]){
			B[i] = j;
			end[i] = 1;
		}
		if (!end[i+1]){
			B[i+1] = j;
			end[i+1] = 1;
		}
	}

	for (i=0;i<N;i++) Report(B[i]);
}

Compilation message

grader.cpp:26:2: warning: no newline at end of file
easy.cpp:1:20: error: grader.h: No such file or directory
easy.cpp: In function 'void Remark(int, int)':
easy.cpp:9: error: 'Mark' was not declared in this scope
easy.cpp: In function 'void GetBestAnswer(int, int*, int)':
easy.cpp:25: error: 'GetScore' was not declared in this scope
easy.cpp:67: error: 'Report' was not declared in this scope