結果

問題 No.2374 ASKT Subsequences
ユーザー erbowlerbowl
提出日時 2023-07-07 22:25:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 946 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 208,520 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-28 23:51:48
合計ジャッジ時間 6,691 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    vector<vector<ll>> p(n);//,p10(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if(a[i]+1==a[j]){
                p[i].push_back(j);
            }
            // if(a[i]+10==a[j]){
            //     p10[i].push_back(j);
            // }
        }
    }
    
    ll ans = 0;
    multiset<ll> ms;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if(j>i+1){
                for (auto e : p[j-1]) {
                    ms.insert(e);
                }
            }
            ms.erase(j);
            if(a[i]+10==a[j]){
                ans += ms.size();
            }
        }
    }
    std::cout << ans << std::endl;
}
0