結果
| 問題 | No.351 市松スライドパズル |
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-10-20 21:35:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 198 ms / 2,000 ms |
| コード長 | 697 bytes |
| 記録 | |
| コンパイル時間 | 1,713 ms |
| コンパイル使用メモリ | 174,100 KB |
| 実行使用メモリ | 44,272 KB |
| 最終ジャッジ日時 | 2024-07-21 08:30:42 |
| 合計ジャッジ時間 | 5,900 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
const string TARGET_NO = "0351";
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll h, w, n;
cin >> h >> w >> n;
stack<pair<string, ll> > st;
for (ll i = 0; i < n; ++i)
{
string s;
ll k;
cin >> s >> k;
st.push(make_pair(s, k));
}
ll c{ 0 }, r{ 0 };
while (!st.empty())
{
pair<string, ll> p = st.top();
st.pop();
if (p.first == "R" && p.second == r)
c = (c + w - 1) % w;
else if (p.first == "C" && p.second == c)
r = (r + h - 1) % h;
}
string res = (r + c) & 1 ? "black" : "white";
cout << res << "\n";
return 0;
}
CELICA