結果

問題 No.2053 12345...
ユーザー butsurizukibutsurizuki
提出日時 2022-08-21 04:08:49
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 9,707 ms
コンパイル使用メモリ 350,808 KB
実行使用メモリ 14,440 KB
最終ジャッジ日時 2024-04-18 01:26:20
合計ジャッジ時間 12,270 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 15 ms
5,928 KB
testcase_04 AC 44 ms
12,784 KB
testcase_05 AC 11 ms
5,808 KB
testcase_06 AC 40 ms
12,796 KB
testcase_07 AC 28 ms
8,384 KB
testcase_08 AC 27 ms
8,500 KB
testcase_09 AC 43 ms
12,920 KB
testcase_10 AC 57 ms
13,560 KB
testcase_11 AC 10 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 56 ms
13,232 KB
testcase_14 AC 20 ms
8,196 KB
testcase_15 AC 17 ms
6,216 KB
testcase_16 AC 17 ms
6,068 KB
testcase_17 AC 12 ms
6,088 KB
testcase_18 AC 62 ms
14,040 KB
testcase_19 AC 45 ms
12,968 KB
testcase_20 AC 6 ms
5,376 KB
testcase_21 AC 28 ms
8,276 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 8 ms
5,376 KB
testcase_24 AC 18 ms
6,236 KB
testcase_25 AC 54 ms
13,236 KB
testcase_26 AC 28 ms
8,416 KB
testcase_27 AC 17 ms
6,228 KB
testcase_28 AC 14 ms
6,148 KB
testcase_29 AC 38 ms
12,636 KB
testcase_30 AC 16 ms
6,056 KB
testcase_31 AC 37 ms
12,576 KB
testcase_32 AC 60 ms
14,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char* argv[]){
  registerValidation(argc, argv);

  long long n=inf.readLong(2ll,200000ll);inf.readEoln();
  vector<long long> a=inf.readLongs(n,1ll,1000000000ll);inf.readEoln();
  inf.readEof();
  a.push_back(-1);
  long long curl=1,res=0;
  for(long long i=1;i<=n;i++){
    if(a[i-1]+1 == a[i]){curl++;}
    else{
      res+=(curl*(curl-1))/2;
      curl=1;
    }
  }
  cout << res << "\n";
  return 0;
}
0