結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
![]() |
提出日時 | 2017-09-17 14:38:32 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 3,430 ms |
コンパイル使用メモリ | 77,268 KB |
実行使用メモリ | 143,884 KB |
最終ジャッジ日時 | 2024-11-08 01:54:05 |
合計ジャッジ時間 | 28,701 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 4 WA * 4 TLE * 9 |
ソースコード
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(); String[] s=new String[n]; int[] k=new int[n]; int nowh=0,noww=0; for(int i=0;i<n;i++) { s[i]=sc.next(); k[i]=sc.nextInt(); } for(int i=n-1;n>=0;n--) { if(s[i].equals("R")) { if(k[i]==nowh) { noww--;noww=(noww==-1)?w-1:noww; } } if(s[i].equals("C")) { if(k[i]==noww) { nowh--;nowh=(nowh==-1)?h-1:nowh; } } } if((nowh+noww)%2==0){System.out.println("white");} else{System.out.println("black");} } }