結果
問題 | No.3069 Torn Documents |
ユーザー | やむなく |
提出日時 | 2020-04-01 05:46:13 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,932 bytes |
コンパイル時間 | 2,038 ms |
コンパイル使用メモリ | 183,824 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 21:36:27 |
合計ジャッジ時間 | 4,662 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 3 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
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 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 3 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | WA | - |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | WA | - |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | WA | - |
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(int i = 0; i < n; i++) flag[s[i]] = true; if(!flag['L'] || !flag['U']){ cout << -1 << endl; return 0; } if(t[0] == 'L'){ cout << 6 << endl; cout << 0 << " " << b+2 << endl; cout << 1 << " " << 0 << endl; cout << 1 << " " << b+1 << endl; cout << a << " " << b-1 << endl; cout << a << " " << b+1 << endl; cout << a+1 << " " << b << endl; }else if(t[0] == 'U'){ cout << 6 << endl; cout << b+2 << " " << 0 << endl; cout << 0 << " " << 1 << endl; cout << b+1 << " " << 1 << endl; cout << b-1 << " " << a << endl; cout << b << " " << a+1 << endl; cout << b+1 << " " << a << endl; }else{ if(t[1] == 'L'){ cout << 6 << endl; cout << 0 << " " << b+2 << endl; cout << 1 << " " << 0 << endl; cout << 1 << " " << b+1 << endl; cout << a << " " << b-1 << endl; cout << a << " " << b+1 << endl; cout << a+1 << " " << b << endl; }else if(t[1] == 'U'){ cout << 6 << endl; cout << b+2 << " " << 0 << endl; cout << 0 << " " << 1 << endl; cout << b+1 << " " << 1 << endl; cout << b-1 << " " << a << endl; cout << b << " " << a+1 << endl; cout << b+1 << " " << a << endl; }else{ cout << -1 << endl; } } return 0; }