結果
| 問題 |
No.1823 Tricolor Dango
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-08 19:25:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 381 bytes |
| コンパイル時間 | 1,817 ms |
| コンパイル使用メモリ | 193,940 KB |
| 最終ジャッジ日時 | 2025-01-28 15:45:28 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%lld", &v);
| ~~~~~^~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d", &T);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
void solve(){
int N;
scanf("%d", &N);
vector<i64> A(N);
for(auto& v : A){
scanf("%lld", &v);
}
i64 sm = accumulate(A.begin(), A.end(), 0ll), mx = (*max_element(A.begin(), A.end()));
puts((sm % 3 == 0 && sm / 3 >= mx) ? "Yes" : "No");
}
int main(){
int T;
scanf("%d", &T);
while(T--){
solve();
}
}