結果

問題 No.2053 12345...
ユーザー nonon
提出日時 2024-09-12 11:57:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 201,432 KB
最終ジャッジ日時 2025-02-24 06:42:52
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin>>N;
    map<int,long>mp;
    for(int i=0;i<N;i++)
    {
        int A;
        cin>>A;
        mp[A]+=mp[A-1]+1;
    }
    long ans=0;
    for(auto[key,val]:mp)ans+=val;
    cout<<ans-N<<endl;
}
0