結果
| 問題 |
No.351 市松スライドパズル
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-05-21 16:20:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 598 bytes |
| コンパイル時間 | 663 ms |
| コンパイル使用メモリ | 60,164 KB |
| 最終ジャッジ日時 | 2024-11-14 19:44:53 |
| 合計ジャッジ時間 | 1,999 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:12:5: error: 'vector' was not declared in this scope
12 | vector<pair<char, int>> q(n);
| ^~~~~~
main.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
2 | #include <algorithm>
+++ |+#include <vector>
3 | #include <string>
main.cpp:12:26: error: expected primary-expression before '>' token
12 | vector<pair<char, int>> q(n);
| ^~
main.cpp:12:29: error: 'q' was not declared in this scope
12 | vector<pair<char, int>> q(n);
| ^
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
cin.sync_with_stdio(0);
cin.tie(0);
int h, w, n; cin>>h>>w>>n;
vector<pair<char, int>> q(n);
for(auto& e: q) {
string s;
int k;
cin>>s>>k;
e=make_pair(s[0], k);
}
reverse(begin(q), end(q));
int r=0, c=0;
for(auto& e: q) {
int k=e.second;
if (e.first=='R') {
if (r==k) c=(c-1+w)%w;
}
else {
if (c==k) r=(r-1+h)%h;
}
}
cout<<((r+c)%2 ? "black" : "white")<<endl;
}
hogeover30