結果

問題 No.2812 Plus Minus Blackboard
ユーザー moguramogura
提出日時 2024-07-19 21:56:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 4,316 ms
コンパイル使用メモリ 228,716 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 20:27:21
合計ジャッジ時間 4,655 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 24 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 22 ms
5,376 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 20 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 13 ms
5,376 KB
testcase_12 AC 10 ms
5,376 KB
testcase_13 AC 22 ms
5,376 KB
testcase_14 AC 7 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 21 ms
5,376 KB
testcase_17 AC 7 ms
5,376 KB
testcase_18 AC 5 ms
5,376 KB
testcase_19 AC 17 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 23 ms
5,376 KB
testcase_22 AC 20 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a));
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a),0LL)
using ll=long long;
using ld=long double;
using ull=unsigned long;
ll MOD=998244353;
ll inf=1e15;
using mint = static_modint<998244353>;
int main(){
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vector<ll>a(n);
  ll sum=0;
  ll min1=inf;
  ll max1=-inf;
  rep(i,n){
  	cin>>a[i];
	sum+=a[i];
	min1=min(min1,a[i]);
	max1=max(max1,a[i]);
  }
  if(sum<=0){
  	if(sum>=min1){cout<<"Yes"<<endl;}
  	else{cout<<"No"<<endl;}
  }
  else{
  		if(sum<=max1){cout<<"Yes"<<endl;}
  		else{cout<<"No"<<endl;}
  	}
}
0