結果
| 問題 |
No.2053 12345...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-24 18:23:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 316 bytes |
| コンパイル時間 | 2,541 ms |
| コンパイル使用メモリ | 201,280 KB |
| 最終ジャッジ日時 | 2025-02-07 14:23:41 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 WA * 7 |
ソースコード
#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';
}