結果

問題 No.1017 Reiwa Sequence
ユーザー ngtkanangtkana
提出日時 2020-04-03 23:19:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,021 bytes
コンパイル時間 3,053 ms
コンパイル使用メモリ 208,004 KB
実行使用メモリ 20,376 KB
最終ジャッジ日時 2023-09-16 04:47:36
合計ジャッジ時間 18,331 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 4 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 8 ms
4,548 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 225 ms
19,724 KB
testcase_20 AC 251 ms
19,760 KB
testcase_21 AC 286 ms
19,804 KB
testcase_22 AC 251 ms
19,716 KB
testcase_23 AC 197 ms
19,744 KB
testcase_24 AC 186 ms
19,748 KB
testcase_25 AC 175 ms
19,728 KB
testcase_26 AC 156 ms
19,836 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 7 ms
4,380 KB
testcase_30 AC 12 ms
5,060 KB
testcase_31 AC 37 ms
7,476 KB
testcase_32 WA -
testcase_33 AC 4 ms
4,380 KB
testcase_34 WA -
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 WA -
testcase_38 AC 2 ms
4,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 16 ms
4,376 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 29 ms
4,376 KB
testcase_49 AC 26 ms
4,380 KB
testcase_50 AC 26 ms
4,388 KB
testcase_51 AC 2 ms
4,380 KB
testcase_52 WA -
testcase_53 AC 76 ms
11,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
using real=long double;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<lint>a(n);
    for(lint&x:a)std::cin>>x;
    lint m=std::min(n,18ll);
    lint M=1ll<<m;
    std::map<lint,lint>map;
    lint bs0=-1,bs1=-1;
    for(lint bs=0;bs<M;bs++){
        lint now=0;
        for(lint i=0;i<m;i++){
            if(!(bs>>i&1))continue;
            now+=a.at(i);
        }
        auto found=map.find(now);
        if(found!=map.end()){
            bs0=found->second;
            bs1=bs;
            break;
        }
        map.emplace(now,bs);
    }
    if(bs0==-1){
        std::cout<<"No"<<'\n';
        return 0;
    }
    std::cout<<"Yes"<<'\n';
    lint an=bs0^bs1;
    bs0^=an,bs1^=an;
    for(lint i=0;i<n;i++){
        lint sign=m<=i?0:bs0>>i&1?+1:bs1>>i&1?-1:0;
        std::cout<<(i?" ":"")<<sign*a.at(i);
    }
    std::cout<<'\n';
}
0