結果

問題 No.2053 12345...
ユーザー Nzt3Nzt3
提出日時 2022-09-24 18:23:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 316 bytes
コンパイル時間 2,258 ms
コンパイル使用メモリ 209,484 KB
実行使用メモリ 21,004 KB
最終ジャッジ日時 2023-08-24 00:32:43
合計ジャッジ時間 6,835 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 29 ms
6,156 KB
testcase_04 AC 89 ms
12,240 KB
testcase_05 AC 18 ms
5,260 KB
testcase_06 AC 91 ms
10,876 KB
testcase_07 AC 55 ms
8,668 KB
testcase_08 AC 45 ms
8,312 KB
testcase_09 AC 94 ms
12,028 KB
testcase_10 AC 137 ms
15,416 KB
testcase_11 AC 14 ms
4,912 KB
testcase_12 AC 12 ms
4,972 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 35 ms
7,700 KB
testcase_17 AC 27 ms
6,800 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 13 ms
4,728 KB
testcase_24 AC 33 ms
6,560 KB
testcase_25 AC 132 ms
14,716 KB
testcase_26 AC 58 ms
8,556 KB
testcase_27 AC 33 ms
6,560 KB
testcase_28 AC 26 ms
5,856 KB
testcase_29 AC 85 ms
10,612 KB
testcase_30 AC 29 ms
6,152 KB
testcase_31 AC 80 ms
10,352 KB
testcase_32 AC 152 ms
16,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<int>A(N);
  for(int &i:A)cin>>i;
  map<int,long long>cnt;
  long long ans=0;
  for(int i=0;i<N;i++){
    ans+=cnt[A[i]-1];
    cnt[A[i]]+=cnt[A[i]-1]+1;
  }
  cout<<ans<<'\n';
}
0