Submission #668058


Source Code Expand

#include<stdio.h>

#define map 900

int main(){
	
	int i,j,k;
	int f;
	int A[map];
	int nowi,nowj;
	int n,now,nexti,nextj;
	int MAX = 0,PLACE;
	int SUM = 0;
	for(i=0;i<map;i++){
		scanf("%d",&A[i]);
		SUM += A[i];
	}

	while(SUM>0){
		MAX = 0;
		for(i=0;i<map;i++){
			if(A[i]>MAX){
				MAX = A[i];
				PLACE = i;
			}
		}
		i = PLACE/30;
		j = PLACE%30;	
		while(A[i*30+j]>0){
			printf("%d %d\n",i+1,j+1);
			A[i*30+j]--;
			SUM--;
			now = A[i*30+j];
			nowi = i;
			nowj = j;
			while(now!=0){
				f = 0;
				if(nowi!=0){
					if(A[(nowi-1)*30+nowj]==now){
						f++;
						nexti = nowi-1;
						nextj = nowj;
					}
				}
				if(nowj!=0){
					if(A[nowi*30+nowj-1]==now){
						f++;
						nexti = nowi;
						nextj = nowj-1;
					}
				}
				if(nowj!=29){
					if(A[nowi*30+nowj+1]==now){
						f++;
						nexti = nowi;
						nextj = nowj+1;
					}
				}
				if(nowi!=29){
					if(A[(nowi+1)*30+nowj]==now){
						f++;
						nexti = nowi+1;
						nextj = nowj;
					}
				}
				if(f == 0){
					break;
				}else{
					printf("%d %d\n",nexti+1,nextj+1);
					A[nexti*30+nextj]--;
					SUM--;
					now = A[nexti*30+nextj];
					nowi = nexti;
					nowj = nextj;
				}
			}
		}
		
	}
	
	
	return 0;
}

Submission Info

Submission Time
Task A - 高橋君の山崩しゲーム
User jango
Language C (GCC 5.4.1)
Score 777524
Code Size 1283 Byte
Status AC
Exec Time 15 ms
Memory 384 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:15:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&A[i]);
   ^

Judge Result

Set Name test_01 test_02 test_03 test_04 test_05 test_06 test_07 test_08 test_09 test_10
Score / Max Score 77872 / 100000 77178 / 100000 77990 / 100000 76808 / 100000 77585 / 100000 78015 / 100000 78069 / 100000 78437 / 100000 77676 / 100000 77894 / 100000
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
Set Name Test Cases
test_01 subtask_01_01.txt
test_02 subtask_01_02.txt
test_03 subtask_01_03.txt
test_04 subtask_01_04.txt
test_05 subtask_01_05.txt
test_06 subtask_01_06.txt
test_07 subtask_01_07.txt
test_08 subtask_01_08.txt
test_09 subtask_01_09.txt
test_10 subtask_01_10.txt
Case Name Status Exec Time Memory
subtask_01_01.txt AC 14 ms 384 KB
subtask_01_02.txt AC 14 ms 384 KB
subtask_01_03.txt AC 13 ms 384 KB
subtask_01_04.txt AC 15 ms 384 KB
subtask_01_05.txt AC 14 ms 384 KB
subtask_01_06.txt AC 13 ms 384 KB
subtask_01_07.txt AC 14 ms 384 KB
subtask_01_08.txt AC 14 ms 384 KB
subtask_01_09.txt AC 14 ms 384 KB
subtask_01_10.txt AC 14 ms 384 KB