답안 #1078532

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078532 2024-08-27T19:25:27 Z oscar1f Broken Device (JOI17_broken_device) C++17
85 / 100
26 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);
    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;
    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)) {
            ajout();
        }
        else {
            passe();
        }
    }
    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++;
        }
    }
    return rep;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 22 ms 2752 KB Output is partially correct - L* = 37
2 Partially correct 20 ms 2864 KB Output is partially correct - L* = 37
3 Partially correct 22 ms 2772 KB Output is partially correct - L* = 37
4 Partially correct 22 ms 2864 KB Output is partially correct - L* = 37
5 Partially correct 22 ms 2784 KB Output is partially correct - L* = 37
6 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
7 Partially correct 20 ms 2828 KB Output is partially correct - L* = 37
8 Partially correct 20 ms 2872 KB Output is partially correct - L* = 37
9 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
10 Partially correct 20 ms 2752 KB Output is partially correct - L* = 37
11 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
12 Partially correct 20 ms 2776 KB Output is partially correct - L* = 37
13 Partially correct 26 ms 2808 KB Output is partially correct - L* = 37
14 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
15 Partially correct 22 ms 2744 KB Output is partially correct - L* = 37
16 Partially correct 22 ms 2752 KB Output is partially correct - L* = 37
17 Partially correct 20 ms 2940 KB Output is partially correct - L* = 37
18 Partially correct 20 ms 2748 KB Output is partially correct - L* = 37
19 Partially correct 22 ms 2752 KB Output is partially correct - L* = 37
20 Partially correct 23 ms 2772 KB Output is partially correct - L* = 37
21 Partially correct 22 ms 2748 KB Output is partially correct - L* = 37
22 Partially correct 20 ms 2748 KB Output is partially correct - L* = 37
23 Partially correct 22 ms 2740 KB Output is partially correct - L* = 37
24 Partially correct 24 ms 2788 KB Output is partially correct - L* = 37
25 Partially correct 20 ms 2836 KB Output is partially correct - L* = 37
26 Partially correct 20 ms 2776 KB Output is partially correct - L* = 37
27 Partially correct 23 ms 2856 KB Output is partially correct - L* = 37
28 Partially correct 23 ms 2804 KB Output is partially correct - L* = 37
29 Partially correct 22 ms 2592 KB Output is partially correct - L* = 37
30 Partially correct 20 ms 2884 KB Output is partially correct - L* = 37
31 Partially correct 26 ms 3028 KB Output is partially correct - L* = 38
32 Partially correct 22 ms 2780 KB Output is partially correct - L* = 37
33 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
34 Partially correct 25 ms 2724 KB Output is partially correct - L* = 37
35 Partially correct 22 ms 2780 KB Output is partially correct - L* = 37
36 Partially correct 23 ms 2724 KB Output is partially correct - L* = 37
37 Partially correct 23 ms 2684 KB Output is partially correct - L* = 37
38 Partially correct 23 ms 2772 KB Output is partially correct - L* = 37
39 Partially correct 22 ms 2748 KB Output is partially correct - L* = 37
40 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37