Submission #00061
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #include<stdio.h> int main(){ int h,w,n,i,c,z=0,a,b,blue=0,red=0; scanf ( "%d%d%d" ,&h,&w,&n); int tile[h][w]; for (i=0;i<h;i++){ for (c=0;c<w;c++){ tile[i][c]=0; } } tile[0][0]=1; i=0; c=1; while (z!=4){ if (z==0){ while (tile[i][c]==0&&c<w){ printf ( "1\n" ); if (tile[i][c-1]==2){ tile[i][c]=1; } else { tile[i][c]=2; } c++; } } else if (z==1){ i=1; c=w-1; while (tile[i][c]==0&&i<h){ printf ( "2\n" ); if (tile[i-1][c]==2){ tile[i][c]=1; } else { tile[i][c]=2; } i++; } } else if (z==2){ i=h-1; c=w-2; while (tile[i][c]==0&&c>=0){ printf ( "3\n" ); if (tile[i][c+1]==2){ tile[i][c]=1; } else { tile[i][c]=2; } c--; } } else if (z==3){ i=h-2; c=0; while (tile[i][c]==0&&i>=0){ printf ( "4\n" ); if (tile[i+1][c]==2){ tile[i][c]=1; } else { tile[i][c]=2; } i--; } } z++; } for (i=0;i<n;i++){ scanf ( "%d %d" ,&a,&b); if (tile[a-1][b-1]==1){ blue++; } else if (tile[a-1][b-1]==2){ red++; } } for (i=0;i<h;i++){ for (c=0;c<w;c++){ printf ( "%d" ,tile[i][c]); } printf ( "\n" ); } printf ( "%d %d\n" ,blue,red); return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - 川柳 (Humorous Poem) |
ユーザー名 | ei1615 |
投稿日時 | 2016-12-07 18:35:22 |
言語 | C |
状態 | Runtime Error |
得点 | 0 |
ソースコード長 | 1329 Byte |
最大実行時間 | 43 ms |
最大メモリ使用量 | 548 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | INPUT1 | 0 / 20 | *1.txt |
2 | INPUT2 | 0 / 20 | *2.txt |
3 | INPUT3 | 0 / 20 | *3.txt |
4 | INPUT4 | 0 / 20 | *4.txt |
5 | INPUT5 | 0 / 20 | *5.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2016-yo-t2-in1.txt | RE | 43 ms | 380 KB |
1
|
||||
2016-yo-t2-in2.txt | RE | 22 ms | 548 KB |
2
|
||||
2016-yo-t2-in3.txt | RE | 28 ms | 384 KB |
3
|
||||
2016-yo-t2-in4.txt | RE | 33 ms | 388 KB |
4
|
||||
2016-yo-t2-in5.txt | RE | 27 ms | 420 KB |
5
|