Submission #22421121


Source Code Expand

Copy
//
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using lc = complex<double>;
/* #include<atcoder/all> */
/* using namespace atcoder; */
template<class T>bool chmax(T &a, const T &b) { return (a<b ? (a=b,1) : 0); }
template<class T>bool chmin(T &a, const T &b) { return (a>b ? (a=b,1) : 0); }
int main(void) {
constexpr ll MOD = 1 ? 1e9+7 : 998244353;
const double PI = acos(-1);
constexpr double eps = 1e-10;
cout << fixed << setprecision(32);
cin.tie(0); ios::sync_with_stdio(false);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// UTF−8

#include<bits/stdc++.h>

using namespace std;
using ll = long long int;
using lc = complex<double>;

/* #include<atcoder/all> */
/* using namespace atcoder; */

template<class T>bool chmax(T &a, const T &b) { return (a<b ? (a=b,1) : 0); }
template<class T>bool chmin(T &a, const T &b) { return (a>b ? (a=b,1) : 0); }

int main(void) {
    constexpr ll MOD = 1 ? 1e9+7 : 998244353;
    const double PI = acos(-1);
    constexpr double eps = 1e-10;
    cout << fixed << setprecision(32);
    cin.tie(0); ios::sync_with_stdio(false);


    if(1) {
        ll n;
        cin >> n;
        vector<ll> a(n);
        for(auto &e: a) cin >> e, e %= 200;

        vector<bitset<200>> dp(n+1), dq(n+1);

        dp[0][0] = 1;
        dq[n][0] = 1;
        for(ll i=0; i<n; i++) {
            bitset<200> x = dp[i];
            x |= x << a[i];
            x |= x >> (200-a[i]);
            dp[i+1] = x;
        }
        for(ll i=n; i>0; i--) {
            bitset<200> x = dq[i];
            x |= x << a[i-1];
            x |= x >> (200-a[i-1]);
            dq[i-1] = x;
        }

        for(ll i=1; i<n; i++) {
            bitset<200> x = dp[i] & dq[i];
            if(x.count()) {
                for(ll k=0; k<200; k++)
                    if(x[k]) {
                        vector<ll> b, c;
                        {
                            ll t = k;
                            for(ll j=i; j>0; j--) {
                                if(dp[j-1][(200+t-a[j-1])%200]) {
                                    t = (200+t-a[j-1]) % 200;
                                    b.push_back(j);
                                }
                            }
                        }
                        {
                            ll t = k;
                            for(ll j=i; j<n; j++)
                                if(dq[j+1][(200+t-a[j])%200]) {
                                    t = (200+t-a[j]) % 200;
                                    c.push_back(j+1);
                                }
                        }
                        if(!(b.size() && c.size())) continue;

                        cout << "Yes" << endl;
                        cout << b.size() << ' ';
                        for(auto &e: b) cout << e << ' ';
                        cout << endl;
                        cout << c.size() << ' ';
                        for(auto &e: c) cout << e << ' ';
                        cout << endl;
                        return 0;
                    }
            }
        }
        cout << "No" << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task D - Happy Birthday! 2
User cookies
Language C++ (GCC 9.2.1)
Score 0
Code Size 2663 Byte
Status WA
Exec Time 7 ms
Memory 3628 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:18: warning: unused variable ‘MOD’ [-Wunused-variable]
   16 |     constexpr ll MOD = 1 ? 1e9+7 : 998244353;
      |                  ^~~
./Main.cpp:17:18: warning: unused variable ‘PI’ [-Wunused-variable]
   17 |     const double PI = acos(-1);
      |                  ^~
./Main.cpp:18:22: warning: unused variable ‘eps’ [-Wunused-variable]
   18 |     constexpr double eps = 1e-10;
      |                      ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 25
WA × 13
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt
Case Name Status Exec Time Memory
sample_01.txt AC 7 ms 3484 KB
sample_02.txt AC 3 ms 3564 KB
sample_03.txt AC 2 ms 3488 KB
test_01.txt AC 2 ms 3484 KB
test_02.txt WA 2 ms 3584 KB
test_03.txt AC 2 ms 3616 KB
test_04.txt WA 2 ms 3416 KB
test_05.txt AC 2 ms 3572 KB
test_06.txt AC 2 ms 3524 KB
test_07.txt AC 2 ms 3504 KB
test_08.txt WA 3 ms 3472 KB
test_09.txt AC 2 ms 3508 KB
test_10.txt AC 2 ms 3576 KB
test_11.txt AC 3 ms 3560 KB
test_12.txt WA 1 ms 3612 KB
test_13.txt AC 2 ms 3524 KB
test_14.txt AC 2 ms 3612 KB
test_15.txt AC 2 ms 3568 KB
test_16.txt WA 2 ms 3592 KB
test_17.txt WA 3 ms 3404 KB
test_18.txt WA 2 ms 3472 KB
test_19.txt WA 2 ms 3508 KB
test_20.txt WA 2 ms 3528 KB
test_21.txt AC 2 ms 3616 KB
test_22.txt AC 3 ms 3628 KB
test_23.txt WA 2 ms 3488 KB
test_24.txt AC 2 ms 3580 KB
test_25.txt AC 2 ms 3512 KB
test_26.txt WA 2 ms 3484 KB
test_27.txt WA 3 ms 3524 KB
test_28.txt AC 2 ms 3564 KB
test_29.txt AC 2 ms 3512 KB
test_30.txt AC 2 ms 3608 KB
test_31.txt AC 2 ms 3424 KB
test_32.txt AC 3 ms 3624 KB
test_33.txt AC 2 ms 3600 KB
test_34.txt AC 2 ms 3616 KB
test_35.txt WA 3 ms 3560 KB


2025-04-11 (Fri)
22:54:36 +00:00