Submission #974344

# Submission time Handle Problem Language Result Execution time Memory
974344 2024-05-03T08:59:10 Z steveonalex Broken Device (JOI17_broken_device) C++17
41 / 100
175 ms 2964 KB
#include <bits/stdc++.h>
#include "Annalib.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
 
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b){a = b; return true;}
        return false;
    }
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b){a = b; return true;}
        return false;
    }
template <class T>
    void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
        for(auto i: a) out << i << separator;
        out << finish;
    }
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

// void Set(int i, int j){cout << j << ",";}

void Anna(int n, ll X, int k, int p[]){

    vector<bool> a(n);
    vector<bool> sigma(n);
    for(int i = 0; i<k; ++i) a[p[i]] = 1;
    int j = 0;
    for(int i = 0; i<60; ++i){
        while(j < n && (a[j] == 1 || a[j+1] == 1)) j++;
        if (j >= n) break;
        cerr << j << " ";
        sigma[j] = 1;
        sigma[j+1] = GETBIT(X, i);
        j += 2;
    }
    cerr << "\n";

    for(int j = 0; j < n; ++j) Set(j, sigma[j]);
}
 
// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//     int p[] = {0};
//     Anna(150, 69420, 1, p);

//     return 0;
// }
#include <bits/stdc++.h>
#include "Brunolib.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
 
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b){a = b; return true;}
        return false;
    }
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b){a = b; return true;}
        return false;
    }
template <class T>
    void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
        for(auto i: a) out << i << separator;
        out << finish;
    }
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

ll Bruno(int n, int A[]){
    ll X = 0;
    int j = 0;
    for(int i = 0; i<60; ++i){
        while(j < n - 1 && A[j] == 0) j++;
        if (j >= n-1) break;
        if (A[j+1]) X += MASK(i);
        j+=2;
    }
    return X;
}
 
// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//     int A[] = {0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//     cout << Bruno(150, A) << "\n";

//     return 0;
// }
# Verdict Execution time Memory Grader output
1 Partially correct 161 ms 2904 KB Output is partially correct - L* = 15
2 Partially correct 142 ms 2580 KB Output is partially correct - L* = 15
3 Partially correct 142 ms 2632 KB Output is partially correct - L* = 17
4 Partially correct 145 ms 2756 KB Output is partially correct - L* = 16
5 Partially correct 144 ms 2764 KB Output is partially correct - L* = 15
6 Partially correct 143 ms 2600 KB Output is partially correct - L* = 15
7 Partially correct 143 ms 2664 KB Output is partially correct - L* = 18
8 Partially correct 140 ms 2688 KB Output is partially correct - L* = 18
9 Partially correct 155 ms 2620 KB Output is partially correct - L* = 16
10 Partially correct 141 ms 2664 KB Output is partially correct - L* = 16
11 Partially correct 153 ms 2656 KB Output is partially correct - L* = 17
12 Partially correct 175 ms 2832 KB Output is partially correct - L* = 17
13 Partially correct 158 ms 2668 KB Output is partially correct - L* = 15
14 Partially correct 164 ms 2580 KB Output is partially correct - L* = 15
15 Partially correct 165 ms 2764 KB Output is partially correct - L* = 16
16 Partially correct 147 ms 2772 KB Output is partially correct - L* = 15
17 Partially correct 146 ms 2684 KB Output is partially correct - L* = 17
18 Partially correct 144 ms 2760 KB Output is partially correct - L* = 16
19 Partially correct 144 ms 2640 KB Output is partially correct - L* = 18
20 Partially correct 146 ms 2916 KB Output is partially correct - L* = 15
21 Partially correct 153 ms 2824 KB Output is partially correct - L* = 15
22 Partially correct 158 ms 2636 KB Output is partially correct - L* = 15
23 Partially correct 142 ms 2696 KB Output is partially correct - L* = 15
24 Partially correct 143 ms 2700 KB Output is partially correct - L* = 17
25 Partially correct 143 ms 2632 KB Output is partially correct - L* = 15
26 Partially correct 150 ms 2744 KB Output is partially correct - L* = 16
27 Partially correct 170 ms 2788 KB Output is partially correct - L* = 15
28 Partially correct 154 ms 2636 KB Output is partially correct - L* = 16
29 Partially correct 149 ms 2964 KB Output is partially correct - L* = 15
30 Partially correct 160 ms 2668 KB Output is partially correct - L* = 16
31 Partially correct 153 ms 2568 KB Output is partially correct - L* = 15
32 Partially correct 158 ms 2624 KB Output is partially correct - L* = 16
33 Partially correct 141 ms 2680 KB Output is partially correct - L* = 15
34 Partially correct 152 ms 2664 KB Output is partially correct - L* = 16
35 Partially correct 150 ms 2876 KB Output is partially correct - L* = 15
36 Partially correct 143 ms 2788 KB Output is partially correct - L* = 15
37 Partially correct 142 ms 2920 KB Output is partially correct - L* = 16
38 Partially correct 144 ms 2780 KB Output is partially correct - L* = 17
39 Partially correct 140 ms 2668 KB Output is partially correct - L* = 15
40 Partially correct 143 ms 2696 KB Output is partially correct - L* = 15