結果
問題 | No.2779 Don't make Pair |
ユーザー | tobbie |
提出日時 | 2024-07-06 06:14:12 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 1,855 ms |
コンパイル使用メモリ | 176,536 KB |
実行使用メモリ | 14,464 KB |
最終ジャッジ日時 | 2024-07-06 06:14:17 |
合計ジャッジ時間 | 4,971 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | WA | - |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 49 ms
8,576 KB |
testcase_13 | AC | 50 ms
8,832 KB |
testcase_14 | AC | 32 ms
6,944 KB |
testcase_15 | AC | 84 ms
11,776 KB |
testcase_16 | WA | - |
testcase_17 | AC | 59 ms
9,344 KB |
testcase_18 | AC | 45 ms
7,936 KB |
testcase_19 | AC | 68 ms
10,496 KB |
testcase_20 | AC | 30 ms
6,940 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 126 ms
14,464 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 116 ms
14,464 KB |
testcase_27 | AC | 120 ms
14,336 KB |
testcase_28 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) int main() { int N; cin >> N; map<int, vector<int>> mp; rep(i, N) { int Ai; cin >> Ai; mp[Ai].push_back(i); } int l = -1, r = N; for (auto it = mp.begin(); it != mp.end(); it++) { if ((it->second).size() > 2) { l = N, r = -1; } if ((it->second).size() == 2) { l = max((it->second)[0], l); r = min((it->second)[1], r); } } if (l > r) { cout << 0 << endl; } else if (l < 0) { cout << N-1 << endl; rep(i, N-1) cout << i+1 << " "; cout << endl; } else { cout << r - l << endl; for (int i = l; i < r; i++) cout << i+1 << " "; cout << endl; } return 0; }