Submission #561956

# Submission time Handle Problem Language Result Execution time Memory
561956 2022-05-13T23:24:36 Z aryan12 Broken Device (JOI17_broken_device) C++17
41 / 100
45 ms 2472 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

void Anna(int N, long long X, int K, int P[])
{
    set<int> already_taken;
    for(int i = 0; i < K; i++)
    {
        already_taken.insert(P[i]);
    }
    long long cnt = 0;
    // cout << "X = " << X << "\n";
    for(long long i = 0; i < N; i += 2)
    {
        if(cnt >= 60)
        {
            Set(i, 0);
            Set(i + 1, 0);
            continue;
        }
        long long bit_set = (1LL << cnt) & X;
        // cout << "bit_set = " << bit_set << "\n";
        cnt++;
        if(already_taken.count(i) && already_taken.count(i + 1))
        {
            cnt--;
            Set(i, 0);
            Set(i + 1, 0);
            // cout << "nothing: 00\n";
        }
        else if(bit_set == 0 && (already_taken.count(i) || already_taken.count(i + 1)))
        {
            cnt--;
            Set(i, 0);
            Set(i + 1, 0);
        }
        else if(bit_set != 0 && !already_taken.count(i))
        {
            Set(i, 1);
            Set(i + 1, 0);
            // cout << "10\n";
        }
        else if(bit_set != 0 && !already_taken.count(i + 1))
        {
            Set(i, 0);
            Set(i + 1, 1);
            // cout << "01\n";
        }
        else
        {
            Set(i, 1);
            Set(i + 1, 1);
            // cout << "11\n";
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

long long Bruno(int N, int A[])
{
    // for(long long i = 0; i < N; i++)
    // {
    //     cout << A[i] << " ";
    // }
    // cout << "\n";
    // cout << "\n\n\n\n\n\n\n\n\n\n\n\n BRUNO TURN\n";
    long long ans = 0, cur_bit = 0;
    for(int i = 0; i < N; i += 2)
    {
        // cout << "received: " << A[i] << " " << A[i + 1] << "\n";
        if(A[i] == 0 && A[i + 1] == 0)
        {
            continue;
        }
        if(A[i] == 0 || A[i + 1] == 0)
        {
            // cout << "cur_bit = " << cur_bit << "\n";
            ans += (1LL << cur_bit);
            // cout << "ans = " << ans << "\n";
        }
        cur_bit++;
    }
    // cout << "ans = " << ans << "\n";
    // cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
    // assert(ans % 2 == 0);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 41 ms 2240 KB Output is partially correct - L* = 17
2 Partially correct 34 ms 2220 KB Output is partially correct - L* = 16
3 Partially correct 33 ms 2332 KB Output is partially correct - L* = 19
4 Partially correct 34 ms 2300 KB Output is partially correct - L* = 16
5 Partially correct 37 ms 2160 KB Output is partially correct - L* = 17
6 Partially correct 36 ms 2316 KB Output is partially correct - L* = 15
7 Partially correct 37 ms 2436 KB Output is partially correct - L* = 18
8 Partially correct 34 ms 2332 KB Output is partially correct - L* = 18
9 Partially correct 37 ms 2420 KB Output is partially correct - L* = 18
10 Partially correct 36 ms 2280 KB Output is partially correct - L* = 16
11 Partially correct 35 ms 2376 KB Output is partially correct - L* = 17
12 Partially correct 33 ms 2312 KB Output is partially correct - L* = 20
13 Partially correct 33 ms 2232 KB Output is partially correct - L* = 18
14 Partially correct 33 ms 2400 KB Output is partially correct - L* = 18
15 Partially correct 33 ms 2308 KB Output is partially correct - L* = 16
16 Partially correct 35 ms 2352 KB Output is partially correct - L* = 19
17 Partially correct 35 ms 2276 KB Output is partially correct - L* = 21
18 Partially correct 34 ms 2396 KB Output is partially correct - L* = 16
19 Partially correct 33 ms 2336 KB Output is partially correct - L* = 18
20 Partially correct 34 ms 2256 KB Output is partially correct - L* = 16
21 Partially correct 35 ms 2348 KB Output is partially correct - L* = 15
22 Partially correct 44 ms 2472 KB Output is partially correct - L* = 17
23 Partially correct 34 ms 2332 KB Output is partially correct - L* = 18
24 Partially correct 35 ms 2364 KB Output is partially correct - L* = 17
25 Partially correct 33 ms 2360 KB Output is partially correct - L* = 18
26 Partially correct 33 ms 2240 KB Output is partially correct - L* = 16
27 Partially correct 34 ms 2332 KB Output is partially correct - L* = 15
28 Partially correct 34 ms 2204 KB Output is partially correct - L* = 16
29 Partially correct 35 ms 2320 KB Output is partially correct - L* = 16
30 Partially correct 34 ms 2376 KB Output is partially correct - L* = 20
31 Partially correct 33 ms 2252 KB Output is partially correct - L* = 15
32 Partially correct 39 ms 2244 KB Output is partially correct - L* = 18
33 Partially correct 34 ms 2304 KB Output is partially correct - L* = 15
34 Partially correct 45 ms 2296 KB Output is partially correct - L* = 16
35 Partially correct 34 ms 2248 KB Output is partially correct - L* = 15
36 Partially correct 34 ms 2264 KB Output is partially correct - L* = 15
37 Partially correct 33 ms 2408 KB Output is partially correct - L* = 16
38 Partially correct 38 ms 2364 KB Output is partially correct - L* = 18
39 Partially correct 34 ms 2288 KB Output is partially correct - L* = 17
40 Partially correct 35 ms 2168 KB Output is partially correct - L* = 17