結果
問題 |
No.2053 12345...
|
ユーザー |
![]() |
提出日時 | 2022-10-18 10:37:50 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 371 bytes |
コンパイル時間 | 2,963 ms |
コンパイル使用メモリ | 244,980 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-28 19:43:27 |
合計ジャッジ時間 | 6,149 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<int> a(n); for(auto& aa:a)cin>>aa; int l,r; l=0;r=1; int ans=0; for(int i=0;i<n-1;i++){ if(a[i+1]-a[i]!=1)continue; r=i+1; while(r<n&&a[r]-a[r-1]==1)r++; r--; ans+=(r-i)*(r-i+1)/2; i=r; } cout<<ans<<endl; }