結果

問題 No.1823 Tricolor Dango
ユーザー cumincumin
提出日時 2022-01-28 23:24:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 3,508 bytes
コンパイル時間 4,167 ms
コンパイル使用メモリ 260,040 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 22:00:19
合計ジャッジ時間 6,326 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 47 ms
4,376 KB
testcase_02 AC 46 ms
4,376 KB
testcase_03 AC 46 ms
4,380 KB
testcase_04 AC 29 ms
4,380 KB
testcase_05 AC 29 ms
4,376 KB
testcase_06 AC 29 ms
4,376 KB
testcase_07 AC 26 ms
4,376 KB
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 27 ms
4,380 KB
testcase_10 AC 27 ms
4,380 KB
testcase_11 AC 28 ms
4,380 KB
testcase_12 AC 23 ms
4,376 KB
testcase_13 AC 27 ms
4,376 KB
testcase_14 AC 29 ms
4,376 KB
testcase_15 AC 25 ms
4,376 KB
testcase_16 AC 11 ms
4,380 KB
testcase_17 AC 15 ms
4,376 KB
testcase_18 AC 27 ms
4,380 KB
testcase_19 AC 74 ms
4,384 KB
testcase_20 AC 27 ms
4,384 KB
testcase_21 AC 35 ms
4,376 KB
testcase_22 AC 44 ms
4,376 KB
testcase_23 AC 30 ms
4,376 KB
testcase_24 AC 36 ms
4,376 KB
testcase_25 AC 44 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/tag_and_trait.hpp>
//using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, n) for(int i = n; i >= 0; i--)
#define rrep2(i, a, b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define eb emplace_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define endl '\n'
template<class T> using pq = priority_queue< T >;
template<class T> using pqg = priority_queue< T , vector< T >, greater< T >>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll digit(ll x){
  string s = to_string(x);
  return (ll)s.size();
}
#define debug(arg) print(#arg, arg)

// std::cerr << arg が元々使えるやつはそれを使う
template <class Tp> void out(Tp arg) {
  std::cerr << arg;
}
// std::pair の出力
template <class Tp1, class Tp2> void out(std::pair<Tp1, Tp2> arg) {
  std::cerr << '(';
  out(arg.first);
  std::cerr << ", ";
  out(arg.second);
  std::cerr << ')';
}
// std::tuple の出力
template <class T, std::size_t... Is> void print_tuple(T arg, std::index_sequence<Is...>) {
  static_cast<void>(((std::cerr << (Is == 0 ? "" : ", "), out(std::get<Is>(arg))), ...));
}
template <class... Ts> void out(std::tuple<Ts...> arg) {
  std::cerr << '(';
  print_tuple(arg, std::make_index_sequence<sizeof...(Ts)>());
  std::cerr << ')';
}
// std::{vector, deque, forward_list, list, initializer_list, set, multiset, unordered_set, unordered_multiset, map, multimap, unordered_map, unordered_multimap, valarray} の出力
template <template <class...> class Container, class... Ts>
void out(Container<Ts...> arg) {
  std::cerr << "[ ";
  std::for_each(std::cbegin(arg), std::cend(arg), [](typename Container<Ts...>::value_type elem) {
    out(elem);
    std::cerr << ' ';
  });
  std::cerr << ']';
}
// std::array の出力
template <class Tp, std::size_t N> void out(std::array<Tp, N> arg) {
  std::cerr << "[ ";
  std::for_each(std::cbegin(arg), std::cend(arg), [](Tp elem) {
    out(elem);
    std::cerr << ' ';
  });
  std::cerr << ']';
}

template <class Tp> void print(std::string_view name, Tp arg) {
  std::cerr << name << ": ";
  out(arg);  // out 関数を使うように変更
  std::cerr << '\n';
}

const int inf = 1001001001;
const ll INF = 1001001001001001001;

const double PI = acos(-1);

bool range(int y, int x, int h, int w){
  return (0 <= y && y < h && 0 <= x && x < w);
}
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

using mint = modint998244353;
const int MOD = 998244353;
//using mint = modint1000000007;
//const int MOD = 1000000007;

signed main(){
  cout << fixed << setprecision(15);
  
  int T;
  cin >> T;
  while(T--){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    ll sum = 0;
    rep(i, N) sum += A[i];
    if(sum%3 == 0 && sum/3 >= MAX(A)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  
  return 0;
}
0