結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
|
提出日時 | 2017-04-27 23:37:51 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,203 bytes |
コンパイル時間 | 2,520 ms |
コンパイル使用メモリ | 103,424 KB |
実行使用メモリ | 56,704 KB |
最終ジャッジ日時 | 2024-09-13 14:55:30 |
合計ジャッジ時間 | 11,669 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 WA * 2 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static string Solve(int w, int h, int n, string[] slist, int[] klist) { int x = 0, y = 0; // 初期位置 : R のとき x を、C のとき y を更新 for (int ii = n - 1; ii >= 0; --ii) { // 行の押し出し if (slist[ii] == "R") { if (klist[ii] == y) { x = (x - 1 + w) % w; } } // 列の押し出し else if (slist[ii] == "C") { if (klist[ii] == x) { y = (y - 1 + h) % h; } } } string result = ((x + y) % 2 == 0) ? "white" : "black"; return result; } static string No_351() { // w h String[] str = Console.ReadLine().Split(' '); int w = Int32.Parse(str[0]); int h = Int32.Parse(str[1]); // n int n = Int32.Parse(Console.ReadLine()); // S K string[] slist = new string[1000000]; int[] klist = new int[1000000]; for (int ii = 0; ii < n; ++ii) { str = Console.ReadLine().Split(' '); slist[ii] = str[0]; klist[ii] = Int32.Parse(str[1]); } return Solve(w, h, n, slist, klist); } static void Main(string[] args) { Console.WriteLine(No_351()); } }