Submission #1078607

# Submission time Handle Problem Language Result Execution time Memory
1078607 2024-08-27T22:22:43 Z oscar1f Broken Device (JOI17_broken_device) C++17
0 / 100
17 ms 3028 KB
#include<bits/stdc++.h>
#include "Annalib.h"
using namespace std;
using ll=long long;

static const ll TAILLE_MAX=150+5,NB_HASARD=(ll)(1000*1000*1000+9)*(ll)(1000*1000*1000+7);
static bool estCache[TAILLE_MAX];
static ll nbVal,numBloc,pos;
static vector<ll> ans,listeTrois;
static vector<vector<ll>> corres={{1,2,3},{3,1,2},{2,3,1}};

static void envoi(vector<ll> v) {
    for (int i=0;i<nbVal;i++) {
        Set(i,v[i]);
    }
}

static void ajout() {
    ans.push_back((corres[(NB_HASARD/numBloc)%3][listeTrois.back()])/2);
    ans.push_back((corres[(NB_HASARD/numBloc)%3][listeTrois.back()])%2);
    numBloc++;
    listeTrois.pop_back();
    pos+=2;
}

static void passe() {
    ans.push_back(0);
    ans.push_back(0);
    numBloc+=2;
    pos+=2;
}

void Anna(int N,ll X,int K,int P[]) {
    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;
    }
    listeTrois.clear();
    while (obj>0) {
        listeTrois.push_back(obj%3);
        obj/=3;
    }
    ans.clear();
    pos=0;
    numBloc=1;
    int nbGagne=0;
    while (pos<nbVal) {
        if (!listeTrois.empty() and (!estCache[pos] or (corres[(NB_HASARD/numBloc)%3][listeTrois.back()])/2==0) 
                                and (!estCache[pos+1] or (corres[(NB_HASARD/numBloc)%3][listeTrois.back()])%2==0)) {
            if (estCache[pos] or estCache[pos+1]) {
                nbGagne++;
            }
            ajout();
        }
        else {
            passe();
        }
    }
    cout<<nbGagne<<" ";
    envoi(ans);
    //cout<<endl;
}
#include<bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
using ll=long long;

static const ll NB_HASARD=(ll)(1000*1000*1000+9)*(ll)(1000*1000*1000+7);
static vector<vector<ll>> corres{{0,1,2},{1,2,0},{2,0,1}};

ll Bruno(int N,int A[]) {
    ll nbVal=N,rep=0,suiv,numBloc=1;
    vector<ll> recu;
    for (int i=0;i<nbVal;i+=2) {
        suiv=2*A[i]+A[i+1]-1;
        if (suiv>=0) {
            rep*=3;
            rep+=corres[(NB_HASARD/numBloc)%3][suiv];
            numBloc++;
        }
        else {
            numBloc+=2;
        }
    }
    return rep;
}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 13 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 13 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 13 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 14 ms 2836 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 12 ms 2848 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 14 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 14 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 13 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 17 ms 2648 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 13 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 13 ms 2864 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 14 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 13 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 14 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 14 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 13 ms 3028 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 14 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 13 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 13 ms 2788 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 13 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 13 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 15 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 13 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 14 ms 2716 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 13 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 16 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 14 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 13 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 13 ms 2792 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 13 ms 2884 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 13 ms 2756 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 14 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 14 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 13 ms 2788 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 13 ms 2808 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 15 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 13 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 16 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 14 ms 2768 KB Program terminated incorrectly, or you printed something to stdout