結果
問題 | No.8069 Torn Documents |
ユーザー | やむなく |
提出日時 | 2020-04-01 18:28:16 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 4 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | WA | - |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | AC | 2 ms
5,376 KB |
testcase_26 | AC | 2 ms
5,376 KB |
testcase_27 | AC | 2 ms
5,376 KB |
ソースコード
#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; }