結果
| 問題 |
No.8069 Torn Documents
|
| コンテスト | |
| ユーザー |
やむなく
|
| 提出日時 | 2020-04-01 18:28:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,863 bytes |
| コンパイル時間 | 2,020 ms |
| コンパイル使用メモリ | 183,864 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-21 21:37:29 |
| 合計ジャッジ時間 | 4,123 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string s;
cin >> s;
int n = s.size();
int pre = 0;
string t;
map<char, int> type = {
{'L', 1},
{'R', 1},
{'D', 2},
{'U', 2}
};
for(int i = n - 1; i >= 0; i--){
if(type[s[i]] == pre) continue;
t.push_back(s[i]);
pre = type[s[i]];
}
map<char, bool> flag;
for(auto &c : t) flag[c] = true;
if(!flag['L'] || !flag['U']){
cout << -1 << endl;
return 0;
}
if(t[0] == 'L'){
cout << 6 << endl;
cout << 0 << " " << 1 << endl;
cout << a+1 << " " << 1 << endl;
cout << a-1 << " " << b << endl;
cout << a << " " << b+1 << endl;
cout << a+1 << " " << b << endl;
cout << a+2 << " " << 0 << endl;
}else if(t[0] == 'U'){
cout << 6 << endl;
cout << 0 << " " << 1 << endl;
cout << a+1 << " " << 1 << endl;
cout << a-1 << " " << b << endl;
cout << a << " " << b+1 << endl;
cout << a+1 << " " << b << endl;
cout << a+2 << " " << 0 << endl;
}else{
if(t[1] == 'L'){
cout << 6 << endl;
cout << 0 << " " << 1 << endl;
cout << a+1 << " " << 1 << endl;
cout << a-1 << " " << b << endl;
cout << a << " " << b+1 << endl;
cout << a+1 << " " << b << endl;
cout << a+2 << " " << 0 << endl;
}else if(t[1] == 'U'){
cout << 6 << endl;
cout << 0 << " " << 1 << endl;
cout << a+1 << " " << 1 << endl;
cout << a-1 << " " << b << endl;
cout << a << " " << b+1 << endl;
cout << a+1 << " " << b << endl;
cout << a+2 << " " << 0 << endl;
}else{
cout << -1 << endl;
}
}
return 0;
}
やむなく