結果
| 問題 |
No.1594 Three Classes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-11 22:07:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 530 bytes |
| コンパイル時間 | 2,193 ms |
| コンパイル使用メモリ | 194,848 KB |
| 最終ジャッジ日時 | 2025-01-23 17:39:14 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
int n; cin>>n;
vector<int>e(n);
int m = 1;
for(int i=0; i<n; i++){
m *= 3;
cin>>e[i];
}
for(int bit=0; bit<m; bit++){
auto d = bit;
int a{},b{},c{};
for(int i=0; i<n; i++){
if(d%3==0)a+=e[i];
if(d%3==1)b+=e[i];
if(d%3==2)c+=e[i];
d /= 3;
}
if(a==b&&b==c){
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No"<<endl;
}