結果
問題 |
No.2055 12x34...
|
ユーザー |
![]() |
提出日時 | 2022-08-29 21:59:26 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 2,975 ms |
コンパイル使用メモリ | 164,736 KB |
実行使用メモリ | 26,240 KB |
最終ジャッジ日時 | 2024-11-06 19:08:40 |
合計ジャッジ時間 | 8,698 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; int A[200010]; cin >> N; for(int i = 0; i < N; i++) cin >> A[i]; map<int, long long> mp; long long ans = -N; for(int i = 0; i < N; i++){ ans += mp[A[i] - 1] + 1; mp[A[i]] += mp[A[i] - 1] + 1; } cout << ans << "\n"; }