結果

問題 No.1823 Tricolor Dango
ユーザー akasinn
提出日時 2022-01-29 11:48:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 169,080 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-01 19:21:57
合計ジャッジ時間 4,210 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

int main() {
  int t,n;
  ll a,b,c;
  cin>>t;
  while(t--){
    cin>>n;
    priority_queue<ll> pq;
    for(int i=0;i<n;i++){ 
      cin>>a;
      pq.push(a);
    }
    for(int i=0;i<n-3;i++){ 
      a=pq.top();
      pq.pop();
      b=pq.top();
      pq.pop();
      c=pq.top();
      pq.pop();
      pq.push(a-c);
      pq.push(b-c);
    }
    a=pq.top();
    pq.pop();
    b=pq.top();
    pq.pop();
    c=pq.top();
    if(a==b && b==c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}
0