結果

問題 No.1389 Clumsy Calculation
ユーザー chineristACchineristAC
提出日時 2021-02-12 00:27:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 1,058 bytes
コンパイル時間 7,375 ms
コンパイル使用メモリ 226,764 KB
実行使用メモリ 7,420 KB
最終ジャッジ日時 2023-09-27 00:44:09
合計ジャッジ時間 9,083 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,384 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 38 ms
4,380 KB
testcase_10 AC 13 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 70 ms
7,248 KB
testcase_15 AC 75 ms
7,188 KB
testcase_16 AC 70 ms
7,344 KB
testcase_17 AC 74 ms
7,144 KB
testcase_18 AC 72 ms
7,244 KB
testcase_19 AC 71 ms
7,156 KB
testcase_20 AC 70 ms
7,200 KB
testcase_21 AC 72 ms
7,304 KB
testcase_22 AC 71 ms
7,204 KB
testcase_23 AC 71 ms
7,336 KB
testcase_24 AC 71 ms
7,156 KB
testcase_25 AC 69 ms
7,280 KB
testcase_26 AC 61 ms
7,292 KB
testcase_27 AC 66 ms
7,272 KB
testcase_28 AC 70 ms
7,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 = 1;
const long long MAX_N = 200000;
const long long MIN_X = 0;
const long long MAX_X = 1000000000;
const long long MIN_S = 1;
const long long MAX_S = 1000000000;

void validate(){
  long long N = inf.readLong(MIN_N,MAX_N);
  inf.readSpace();
  long long X = inf.readLong(MIN_X,MAX_X);
  inf.readEoln();

  long long Sum = 0;
  long long S;
  set<ll> T;
  for (long long i=0;i<N;i++){
    S = inf.readLong(MIN_S,MAX_S);
    T.insert(S);
    Sum += S;
    if (i!=N-1){
      inf.readSpace();
    }
    else{
      inf.readEoln();
    }
  }

  Sum -= (N-1) * X;
  if (T.find(2*Sum)==T.end()){
    for (int i=0;i<10;i++){
      inf.readEoln();
    }
  }
  else{
    inf.readEof();
  }
  cout<<Sum<<endl;
}

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