結果
問題 | No.1017 Reiwa Sequence |
ユーザー | hiikunZ |
提出日時 | 2021-07-18 12:31:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 1,263 bytes |
コンパイル時間 | 2,344 ms |
コンパイル使用メモリ | 212,596 KB |
実行使用メモリ | 36,848 KB |
最終ジャッジ日時 | 2024-07-08 05:58:28 |
合計ジャッジ時間 | 33,960 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
34,388 KB |
testcase_01 | AC | 12 ms
34,340 KB |
testcase_02 | AC | 11 ms
34,360 KB |
testcase_03 | AC | 11 ms
34,408 KB |
testcase_04 | AC | 12 ms
34,304 KB |
testcase_05 | AC | 11 ms
34,448 KB |
testcase_06 | AC | 11 ms
34,388 KB |
testcase_07 | AC | 11 ms
34,340 KB |
testcase_08 | AC | 11 ms
34,408 KB |
testcase_09 | AC | 11 ms
34,488 KB |
testcase_10 | AC | 12 ms
34,304 KB |
testcase_11 | AC | 11 ms
34,368 KB |
testcase_12 | AC | 12 ms
34,520 KB |
testcase_13 | AC | 12 ms
34,304 KB |
testcase_14 | AC | 12 ms
34,416 KB |
testcase_15 | AC | 12 ms
34,424 KB |
testcase_16 | AC | 12 ms
34,344 KB |
testcase_17 | AC | 12 ms
34,368 KB |
testcase_18 | AC | 11 ms
34,376 KB |
testcase_19 | AC | 46 ms
34,444 KB |
testcase_20 | AC | 45 ms
34,368 KB |
testcase_21 | AC | 46 ms
34,344 KB |
testcase_22 | AC | 47 ms
34,344 KB |
testcase_23 | AC | 49 ms
34,424 KB |
testcase_24 | AC | 44 ms
34,340 KB |
testcase_25 | AC | 45 ms
34,372 KB |
testcase_26 | AC | 48 ms
34,376 KB |
testcase_27 | AC | 35 ms
34,400 KB |
testcase_28 | AC | 44 ms
34,408 KB |
testcase_29 | AC | 12 ms
34,372 KB |
testcase_30 | AC | 13 ms
34,456 KB |
testcase_31 | AC | 16 ms
34,344 KB |
testcase_32 | AC | 29 ms
34,412 KB |
testcase_33 | AC | 12 ms
34,456 KB |
testcase_34 | AC | 30 ms
34,300 KB |
testcase_35 | AC | 12 ms
34,336 KB |
testcase_36 | AC | 11 ms
34,412 KB |
testcase_37 | AC | 28 ms
34,384 KB |
testcase_38 | AC | 11 ms
34,364 KB |
testcase_39 | AC | 28 ms
34,440 KB |
testcase_40 | AC | 80 ms
35,740 KB |
testcase_41 | AC | 80 ms
35,940 KB |
testcase_42 | AC | 77 ms
35,860 KB |
testcase_43 | AC | 79 ms
35,712 KB |
testcase_44 | AC | 42 ms
35,840 KB |
testcase_45 | AC | 78 ms
35,880 KB |
testcase_46 | AC | 77 ms
35,812 KB |
testcase_47 | AC | 77 ms
35,752 KB |
testcase_48 | AC | 58 ms
36,848 KB |
testcase_49 | AC | 56 ms
36,756 KB |
testcase_50 | AC | 65 ms
36,836 KB |
testcase_51 | AC | 11 ms
34,444 KB |
testcase_52 | AC | 45 ms
34,368 KB |
testcase_53 | AC | 20 ms
34,444 KB |
ソースコード
#include<bits/stdc++.h> #include <atcoder/twosat> using namespace std; using namespace atcoder; using ll = long long int; using ld = long double; const ll MAX = 5000000000000000000; const ld PI = 3.14159265358979; const ll MOD = 0;//2024948111; ld dotorad(ld K){return PI * K / 180.0;} ld radtodo(ld K){return K * 180.0 / PI;} mt19937 mt; void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());} int main(){ ll N; cin >> N; vector<ll> A(N); for(ll i = 0;i < N;i++) cin >> A[i]; ll n = min(25LL,N); vector<ll> memo(4000000,-1); ll ans1 = -1,ans2 = -1; for(ll bit = 0;bit < (1LL << n);bit++){ ll p = 0; for(ll i = 0;i < n;i++){ if(bit & (1LL << i)) p += A[i]; } if(memo[p] != -1){ ans1 = memo[p]; ans2 = bit; break; } memo[p] = bit; } if(ans1 == -1) cout << "No" << endl; else{ cout << "Yes" << endl; vector<ll> B(N,0); ll s = 0; for(ll i = 0;i < n;i++){ if(ans1 & (1LL << i)) B[i] += A[i]; if(ans2 & (1LL << i)) B[i] -= A[i]; s += B[i]; } for(ll i = 0;i < N - 1;i++) cout << B[i] << ' '; cout << B[N - 1] << endl; } }