結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2017-09-17 14:16:25 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,001 bytes |
コンパイル時間 | 3,517 ms |
コンパイル使用メモリ | 77,644 KB |
実行使用メモリ | 478,912 KB |
最終ジャッジ日時 | 2024-11-08 01:53:17 |
合計ジャッジ時間 | 13,418 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 TLE * 1 -- * 7 |
ソースコード
package yukicoder; import java.util.Scanner; public class N351 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int h=sc.nextInt(),w=sc.nextInt(); int n=sc.nextInt(); int[][] a=new int[h][w]; int buf=0; for(int i=0;i<h;i++) { for(int j=(i+1)%2;j<w;j+=2) { a[i][j]++; } } for(int i=0;i<n;i++) { String s=sc.next(); int num=sc.nextInt(); if(s.equals("R")) { buf=a[num][w-1]; for(int j=w-1;j>=1;j--) { a[num][j]=a[num][j-1]; } a[num][0]=buf; } else if(s.equals("C")) { buf=a[h-1][num]; for(int j=h-1;j>=1;j--) { a[j][num]=a[j-1][num]; } a[0][num]=buf; } /*System.out.println("-----------------"); for(int[] aa:a) { for(int aaa:aa) { System.out.print(aaa+" "); } System.out.println(); } System.out.println("-----------------");*/ } if(a[0][0]==1){System.out.println("black");} else{System.out.println("white");} } }