# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078410 | oscar1f | Broken Device (JOI17_broken_device) | C++17 | 27 ms | 2900 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|---|---|---|---|
Fetching results... |