結果
問題 | No.2053 12345... |
ユーザー |
![]() |
提出日時 | 2024-09-12 12:04:19 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 344 bytes |
コンパイル時間 | 2,222 ms |
コンパイル使用メモリ | 201,296 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-12 12:04:23 |
合計ジャッジ時間 | 4,178 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#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=0;i<N;i++)cin>>A[i];long ans=0;for(int i=1;i<N;){int j=i;while(j<N&&A[j-1]==A[j]-1)j++,ans+=j-i;i=j+1;}cout<<ans<<endl;}