| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1078517 | oscar1f | Broken Device (JOI17_broken_device) | C++17 | 34 ms | 3040 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 void envoi(vector<ll> v) {
    for (int i=0;i<nbVal;i++) {
        Set(i,v[i]);
    }
}
static void ajout() {
    if ((NB_HASARD/numBloc)%2==0) {
        ans.push_back((listeTrois.back()+1)/2);
        ans.push_back((listeTrois.back()+1)%2);
    }
    else {
        ans.push_back((3-listeTrois.back())/2);
        ans.push_back((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] and !estCache[pos+1]) {
            ajout();
        }
        else if (!listeTrois.empty()) {
            if ((NB_HASARD/numBloc)%2==0) {
                if (!estCache[pos] and listeTrois.back()==1) {
                    ajout();
                }
                else if (!estCache[pos+1] and listeTrois.back()==0) {
                    ajout();
                }
                else {
                    passe();
                }
            }
            else {
                if (!estCache[pos] and listeTrois.back()==1) {
                    ajout();
                }
                else if (!estCache[pos+1] and listeTrois.back()==2) {
                    ajout();
                }
                else {
                    passe();
                }
            }
        }
        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);
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];
        if (suiv>0) {
            rep*=3;
            if ((NB_HASARD/numBloc)%2==0) {
                rep+=suiv-1;
            }
            else {
                rep+=3-suiv;
            }
            numBloc++;
        }
    }
    return rep;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
