Submission #907424

# Submission time Handle Problem Language Result Execution time Memory
907424 2024-01-15T14:03:50 Z andrey27_sm Broken Device (JOI17_broken_device) C++17
8 / 100
47 ms 2716 KB
#include <bits/stdc++.h>
#include <Annalib.h>
using namespace std;
 
void Anna( int N, long long X, int K, int P[] ){
    vector<int> L(N,-2);
    stack<int> B;
    while(X) B.push(X&1), X>>=1;
    set<int> used;
    for(int i = 0;i < K;i++) Set(P[i],0),L[P[i]] = -1, used.insert(P[i]);
    for(int i = 0;i < N;i++){
        if(L[i] == -1) continue;
        int cnt = 0;
        while(i+cnt < N and L[i+cnt] == -2) cnt++;
        // cout << i << "-" << i+cnt-1 << "\n";
        int Pcnt = 0;
        if(cnt >= 68 and B.size() >= 60) {
            cnt-=68;
            for(int j = 0;j < 7;j++) {
                used.insert(i+j);
                Set(i+j,1);
            }
            used.insert(i+7);
            Set(i+7,0);
            for(int j = 0;j < 60;j++) {
                used.insert(i+8+j);
                Set(i+8+j,B.top());
                B.pop();
            }
            Pcnt++;
            i += 68;
        }
        if(cnt >= 39 and B.size() >= 32) {
            cnt-=39;
            for(int j = 0;j < 6;j++) {
                used.insert(i+j);
                Set(i+j,1);
            }
            used.insert(i+6);
            Set(i+6,0);
            for(int j = 0;j < 32;j++) {
                used.insert(i+7+j);
                Set(i+7+j,B.top());
                B.pop();
            }
            Pcnt++;
            i += 39;
        }
        if(cnt >= 22 and B.size() >= 16) {
            cnt-=22;
            for(int j = 0;j < 5;j++) {
                used.insert(i+j);
                Set(i+j,1);
            }
            used.insert(i+5);
            Set(i+5,0);
            for(int j = 0;j < 16;j++) {
                used.insert(i+6+j);
                Set(i+6+j,B.top());
                B.pop();
            }
            Pcnt++;
            i += 22;
        }
        if(cnt >= 13 and B.size() >= 8) {
            cnt-=13;
            for(int j = 0;j < 4;j++) {
                used.insert(i+j);
                Set(i+j,1);
            }
            used.insert(i+4);
            Set(i+4,0);
            for(int j = 0;j < 8;j++) {
                used.insert(i+5+j);
                Set(i+5+j,B.top());
                B.pop();
            }
            Pcnt++;
            i += 13;
        }
        if(cnt >= 8 and B.size() >= 4) {
            cnt-=8;
            for(int j = 0;j < 3;j++) {
                used.insert(i+j);
                Set(i+j,1);
            }
            used.insert(i+3);
            Set(i+3,0);
            for(int j = 0;j < 4;j++) {
                used.insert(i+4+j);
                Set(i+4+j,B.top());
                B.pop();
            }
            Pcnt++;
            i += 8;
        }
        if(cnt >= 5 and B.size() >= 2) {
            cnt-=5;
            for(int j = 0;j < 2;j++) {
                used.insert(i+j);
                Set(i+j,1);
            }
            used.insert(i+2);
            Set(i+2,0);
            for(int j = 0;j < 2;j++) {
                used.insert(i+3+j);
                Set(i+3+j,B.top());
                B.pop();
            }
            Pcnt++;
            i += 5;
        }
        if(cnt >= 3 and B.size() >= 1) {
            cnt-=3;
            used.insert(i);
            used.insert(i+1);
            used.insert(i+2);
            Set(i,1);
            Set(i+1,0);
            Set(i+2,B.top());
            B.pop();
            Pcnt++;
            i += 3;
        }
        if(Pcnt) i--;
    }
    for(int i = 0;i < N;i++) {
        if(used.count(i)) continue;
        Set(i,0);
    }
}
 
#include <bits/stdc++.h>
#include <Brunolib.h>
using namespace std;
long long Bruno( int N, int A[] ){
    long long X = 0;
    for(int i = 0;i < N-1;i++){
        if(A[i] == 0) continue;
        int cnt = 0;
        while(A[i] == 1) cnt++,i++;
        //cout << i-cnt << " " << cnt << " " << X << "\n";
        i++;
        int len;
        if(cnt == 7) len = 60;
        else len = (1<<(cnt-1));
        for(int j = 0; j < len;j++) {
            X<<=1;
            X|=A[i+j];
        }
        i+=len-1;
    }
    return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 34 ms 2492 KB Output is partially correct - L* = 15
2 Partially correct 35 ms 2648 KB Output is partially correct - L* = 18
3 Partially correct 47 ms 2408 KB Output is partially correct - L* = 14
4 Partially correct 36 ms 2484 KB Output is partially correct - L* = 17
5 Partially correct 39 ms 2304 KB Output is partially correct - L* = 18
6 Partially correct 38 ms 2320 KB Output is partially correct - L* = 16
7 Partially correct 35 ms 2304 KB Output is partially correct - L* = 19
8 Partially correct 43 ms 2300 KB Output is partially correct - L* = 16
9 Partially correct 40 ms 2628 KB Output is partially correct - L* = 19
10 Partially correct 40 ms 2560 KB Output is partially correct - L* = 14
11 Partially correct 46 ms 2372 KB Output is partially correct - L* = 17
12 Partially correct 35 ms 2564 KB Output is partially correct - L* = 14
13 Partially correct 40 ms 2536 KB Output is partially correct - L* = 18
14 Partially correct 40 ms 2560 KB Output is partially correct - L* = 17
15 Partially correct 40 ms 2708 KB Output is partially correct - L* = 15
16 Partially correct 42 ms 2560 KB Output is partially correct - L* = 15
17 Partially correct 35 ms 2648 KB Output is partially correct - L* = 18
18 Partially correct 42 ms 2564 KB Output is partially correct - L* = 16
19 Partially correct 43 ms 2396 KB Output is partially correct - L* = 17
20 Partially correct 35 ms 2396 KB Output is partially correct - L* = 17
21 Partially correct 38 ms 2516 KB Output is partially correct - L* = 17
22 Partially correct 37 ms 2308 KB Output is partially correct - L* = 18
23 Partially correct 45 ms 2296 KB Output is partially correct - L* = 17
24 Partially correct 43 ms 2432 KB Output is partially correct - L* = 17
25 Partially correct 36 ms 2464 KB Output is partially correct - L* = 15
26 Partially correct 34 ms 2488 KB Output is partially correct - L* = 16
27 Partially correct 35 ms 2716 KB Output is partially correct - L* = 18
28 Partially correct 36 ms 2404 KB Output is partially correct - L* = 16
29 Partially correct 33 ms 2308 KB Output is partially correct - L* = 17
30 Partially correct 34 ms 2564 KB Output is partially correct - L* = 14
31 Partially correct 43 ms 2368 KB Output is partially correct - L* = 19
32 Partially correct 42 ms 2368 KB Output is partially correct - L* = 14
33 Partially correct 42 ms 2332 KB Output is partially correct - L* = 20
34 Partially correct 46 ms 2300 KB Output is partially correct - L* = 20
35 Partially correct 35 ms 2396 KB Output is partially correct - L* = 18
36 Partially correct 46 ms 2628 KB Output is partially correct - L* = 17
37 Partially correct 40 ms 2464 KB Output is partially correct - L* = 17
38 Partially correct 41 ms 2376 KB Output is partially correct - L* = 15
39 Partially correct 39 ms 2460 KB Output is partially correct - L* = 14
40 Partially correct 36 ms 2576 KB Output is partially correct - L* = 18