# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1064348 | Unforgettablepl | Broken Device (JOI17_broken_device) | C++17 | 30 ms | 3008 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
vector<int> convert_to_base3(long long x) {
vector<int> res;
while(x) {
res.emplace_back(x%3);
x/=3;
}
return res;
}
}
void Anna(int N, long long X, int K, int P[]){
vector<bool> bad(N+1);
for(int i=0;i<K;i++)bad[P[i]]=true;
vector<int> num = convert_to_base3(X);
auto iter = num.begin();
for(int i=0;i<N;i+=2) {
if(bad[i] or bad[i+1] or iter==num.end()){Set(i,0);Set(i+1,0);continue;}
if(*iter==0){
Set(i,0);
Set(i+1,1);
} else if(*iter==1) {
Set(i,1);
Set(i+1,0);
} else if(*iter==2) {
Set(i,1);
Set(i+1,1);
}
iter++;
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
long long convert_to_base2(vector<int> num) {
long long X = 0;
reverse(num.begin(),num.end());
for(int&i:num) {
X*=3;
X+=i;
}
return X;
}
}
long long Bruno(int N, int A[]) {
vector<int> num;
for(int i=0;i<N;i+=2){
if(A[i]==0 and A[i+1]==1)num.emplace_back(0);
else if(A[i]==1 and A[i+1]==0)num.emplace_back(1);
else if(A[i]==1 and A[i+1]==1)num.emplace_back(2);
}
return convert_to_base2(num);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |