Submission #1078410

# Submission time Handle Problem Language Result Execution time Memory
1078410 2024-08-27T16:45:59 Z oscar1f Broken Device (JOI17_broken_device) C++17
41 / 100
27 ms 2900 KB
#include<bits/stdc++.h>
#include "Annalib.h"
using namespace std;
using ll=long long;

static const int TAILLE_MAX=150+5;
static bool estCache[TAILLE_MAX];

void Anna(int N,ll X,int K,int P[]) {
    ll nbVal=N;
    ll obj=X;
    ll nbCache=K;
    for (ll i=0;i<nbVal;i++) {
        estCache[i]=false;
    }
    for (ll i=0;i<nbCache;i++) {
        estCache[P[i]]=true;
    }
    vector<ll> listeBit;
    while (obj>0) {
        listeBit.push_back(obj%2);
        obj/=2;
    }
    /*for (int i:listeBit) {
        cout<<i;
    }
    cout<<endl;*/
    ll pos=0;
    while (pos<nbVal) {
        if (!listeBit.empty() and !estCache[pos] and pos<nbVal-1 and (!estCache[pos+1] or listeBit.back()==0)) {
            Set(pos,1);
            Set(pos+1,listeBit.back());
            //cout<<1<<listeBit.back();
            listeBit.pop_back();
            pos+=2;
        }
        else {
            Set(pos,0);
            //cout<<0;
            pos++;
        }
    }
    //cout<<endl;
}
#include<bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
using ll=long long;

ll Bruno(int N,int A[]) {
    ll nbVal=N,pos=0,rep=0;
    while (pos<nbVal) {
        if (A[pos]==1) {
            rep*=2;
            rep+=A[pos+1];
            pos+=2;
        }
        else {
            pos++;
        }
    }
    //cout<<"!"<<rep<<endl;
    return rep;
}
# Verdict Execution time Memory Grader output
1 Partially correct 20 ms 2396 KB Output is partially correct - L* = 17
2 Partially correct 20 ms 2396 KB Output is partially correct - L* = 16
3 Partially correct 20 ms 2452 KB Output is partially correct - L* = 18
4 Partially correct 20 ms 2484 KB Output is partially correct - L* = 17
5 Partially correct 22 ms 2396 KB Output is partially correct - L* = 17
6 Partially correct 20 ms 2404 KB Output is partially correct - L* = 15
7 Partially correct 20 ms 2496 KB Output is partially correct - L* = 18
8 Partially correct 20 ms 2464 KB Output is partially correct - L* = 18
9 Partially correct 24 ms 2520 KB Output is partially correct - L* = 18
10 Partially correct 20 ms 2396 KB Output is partially correct - L* = 16
11 Partially correct 20 ms 2396 KB Output is partially correct - L* = 17
12 Partially correct 22 ms 2396 KB Output is partially correct - L* = 20
13 Partially correct 22 ms 2404 KB Output is partially correct - L* = 18
14 Partially correct 20 ms 2544 KB Output is partially correct - L* = 18
15 Partially correct 20 ms 2484 KB Output is partially correct - L* = 16
16 Partially correct 20 ms 2484 KB Output is partially correct - L* = 17
17 Partially correct 20 ms 2400 KB Output is partially correct - L* = 17
18 Partially correct 23 ms 2400 KB Output is partially correct - L* = 17
19 Partially correct 20 ms 2396 KB Output is partially correct - L* = 18
20 Partially correct 25 ms 2396 KB Output is partially correct - L* = 18
21 Partially correct 22 ms 2392 KB Output is partially correct - L* = 15
22 Partially correct 20 ms 2400 KB Output is partially correct - L* = 16
23 Partially correct 20 ms 2400 KB Output is partially correct - L* = 18
24 Partially correct 20 ms 2392 KB Output is partially correct - L* = 17
25 Partially correct 20 ms 2404 KB Output is partially correct - L* = 21
26 Partially correct 20 ms 2396 KB Output is partially correct - L* = 16
27 Partially correct 22 ms 2476 KB Output is partially correct - L* = 18
28 Partially correct 20 ms 2396 KB Output is partially correct - L* = 19
29 Partially correct 20 ms 2392 KB Output is partially correct - L* = 16
30 Partially correct 20 ms 2392 KB Output is partially correct - L* = 20
31 Partially correct 20 ms 2464 KB Output is partially correct - L* = 17
32 Partially correct 27 ms 2900 KB Output is partially correct - L* = 18
33 Partially correct 22 ms 2392 KB Output is partially correct - L* = 15
34 Partially correct 20 ms 2400 KB Output is partially correct - L* = 18
35 Partially correct 22 ms 2636 KB Output is partially correct - L* = 15
36 Partially correct 20 ms 2392 KB Output is partially correct - L* = 15
37 Partially correct 22 ms 2476 KB Output is partially correct - L* = 16
38 Partially correct 24 ms 2396 KB Output is partially correct - L* = 18
39 Partially correct 20 ms 2396 KB Output is partially correct - L* = 17
40 Partially correct 23 ms 2360 KB Output is partially correct - L* = 17