Submission #2076898


Source Code Expand

#include<stdio.h>

int a[32][32];
int size=32;
int con;
int check[2][1000];
int act[2][1000];
int max=0;

int main(){

        int i,j,k;
        int judge=5;

        for(i=0;i<size;i++){
                a[i][0]=0;
                a[i][size-1]=0;
                a[0][i]=0;
                a[size-1][i]=0;
        }


        for(i=1;i<size-1;i++){
                scanf(" %d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d",&a[i][1],&a[i][2],&a[i][3],&a[i][4],&a[i][5]);
        }

        k=1;

        while(judge != 0){

//              printf("%dループ目\n",k);

                judge =0;

                sub();

                for(i=1;i<size-1;i++){
                        for(j=1;j<size-1;j++){
                                if(a[i][j] != 0){
                                        judge = 5;
                                }

                        }

                }
                k++;
        }

        return 0;

}

int sub(){
        int i,j;

        for(i=0;i<1000;i++){
                check[0][i]=0;
                check[1][i]=0;
                act[0][i]=0;
                act[1][i]=0;
        }

        max=0;

        for(i=1;i<size-1;i++){
                for(j=1;j<size-1;j++){
                        con=0;
                        if(a[i][j] != 0){
                                tonari(i,j,con);
                        }
                }
        }

//      printf("最大は%d\n",max);


        for(j=0;j<max;j++){
                printf("%d %d\n",act[0][j],act[1][j]);
                a[act[0][j]][act[1][j]]=a[act[0][j]][act[1][j]]-1;
        }

}

int tonari(int x ,int y,int z){
        int tmp;
//      printf("(%d,%d)の%dから調べるよ",x,y,a[x][y]);

        check[0][z]=x;
        check[1][z]=y;

        tmp=a[x][y]-1;

        if(a[x+1][y] == tmp && tmp != 0){
                tonari(x+1,y,z+1);
        }
        if(a[x-1][y] == tmp && tmp != 0){
                tonari(x-1,y,z+1);
        }
        if(a[x][y-1] == tmp && tmp != 0){
                tonari(x,y-1,z+1);
        }
        if(a[x][y+1] == tmp && tmp != 0){
                tonari(x,y+1,z+1);
        }
        if(tmp == 0 || (a[x+1][y] != tmp && a[x-1][y] != tmp && a[x][y-1] != tmp && a[x][y+1] != tmp)){
                che(z+1);
        }
}

int che(int con){
        int i;
        if(max < con){
                max = con;
                for(i=0;i<con;i++){
                        act[0][i]=check[0][i];
                        act[1][i]=check[1][i];

//                      printf("(%d,%d)",act[0][i],act[1][i]);
                }
        }
}

Submission Info

Submission Time
Task A - 高橋君の山崩しゲーム
User onono
Language C (GCC 5.4.1)
Score 0
Code Size 2794 Byte
Status WA
Exec Time 18 ms
Memory 384 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
                 scanf(" %d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d*c%d%*c%d%*c%d%*c%d%*c%d",&a[i][1],&a[i][2],&a[i][3],&a[i][4],&a[i][5]);
                       ^
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument [-Wformat=]
./Main.c:24:23: warning: format ‘%d’ expects a matching ‘int *’ argument...

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 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000 0 / 100000
Status
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 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 WA 16 ms 384 KB
subtask_01_02.txt WA 15 ms 256 KB
subtask_01_03.txt WA 15 ms 256 KB
subtask_01_04.txt WA 18 ms 256 KB
subtask_01_05.txt WA 16 ms 256 KB
subtask_01_06.txt WA 16 ms 256 KB
subtask_01_07.txt WA 16 ms 256 KB
subtask_01_08.txt WA 15 ms 256 KB
subtask_01_09.txt WA 15 ms 256 KB
subtask_01_10.txt WA 15 ms 256 KB