結果

問題 No.2374 ASKT Subsequences
ユーザー koki-masutanikoki-masutani
提出日時 2024-03-20 13:00:46
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,024 bytes
コンパイル時間 846 ms
コンパイル使用メモリ 78,368 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-20 13:00:53
合計ジャッジ時間 5,301 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 1 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 1 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 3 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 5 ms
6,548 KB
testcase_15 AC 7 ms
6,548 KB
testcase_16 AC 4 ms
6,548 KB
testcase_17 AC 10 ms
6,548 KB
testcase_18 AC 21 ms
6,548 KB
testcase_19 AC 17 ms
6,548 KB
testcase_20 AC 34 ms
6,548 KB
testcase_21 AC 47 ms
6,548 KB
testcase_22 AC 29 ms
6,548 KB
testcase_23 AC 22 ms
6,548 KB
testcase_24 AC 21 ms
6,548 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

int main() {
    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    unordered_map<int, vector<int>> di;
    for (int i = 0; i < N; ++i) {
        di[A[i]].push_back(i);
    }

    int ans = 0;
    for (int i = 0; i < N - 3; ++i) {
        for (int j = i + 1; j < N - 2; ++j) {
            if (di.find(A[i] + 10) != di.end()) {
                for (int k : di[A[i] + 10]) {
                    if (A[k] > A[j]) break;
                    if (di.find(A[j] + 1) != di.end()) {
                        for (int l : di[A[j] + 1]) {
                            if (A[i] + 10 == A[k] && A[j] + 1 == A[l] && A[i] < A[j] && A[j] > A[k] && A[k] < A[l] && i < j && j < k && k < l) {
                                ans++;
                            }
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}
0