結果

問題 No.1555 Constructed Balancing Sequence
コンテスト
ユーザー chineristAC
提出日時 2021-02-15 20:07:32
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 887 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,280 ms
コンパイル使用メモリ 266,996 KB
実行使用メモリ 7,912 KB
最終ジャッジ日時 2026-06-17 23:19:18
合計ジャッジ時間 7,995 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include"testlib.h"
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<random>
#include<stdio.h>
using namespace std;

typedef long long ll;
const long long MIN_N = 2;
const long long MAX_N = 100000;
const long long MIN_K = 1;
const long long MAX_K = 100000;

void validate(){

  long long N = inf.readLong(MIN_N,MAX_N,"N");
  inf.readSpace();
  long long K = inf.readLong(MIN_K,MAX_K,"K");
  inf.readEoln();
  long long S = 0;
  long long a = 0;
  for (long long i=0;i<N;i++){
    a = inf.readLong(-K,K);
    if (i!=0){
      if (S < a){
        inf.readEof();
      }
    }
    S += a;
    if (i!=N-1){
      inf.readSpace();
    }
    else{
      inf.readEoln();
    }
  }
  inf.readEof();
}

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