# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63298 | Arturgo | Broken Device (JOI17_broken_device) | C++14 | 81 ms | 12136 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include "Annalib.h"
using namespace std;
vector<vector<int>> motifs = {
{1, 1, 1},
{1, 1, 0},
{0, 1, 1},
{0, 0, 1},
{1, 0, 1},
{0, 1, 0},
{1, 0, 0},
{0, 0, 0}
};
vector<vector<int>> reponses = {
{1, 1},
{1, 0},
{0, 1},
{0, 0},
{1},
{1},
{0},
{}
};
void Anna(int N, long long X, int K, int P[]) {
vector<int> broken(N, 0);
for(int iBroken = 0;iBroken < K;iBroken++) {
broken[P[iBroken]] = 1;
}
vector<bool> number(1000, 0);
for(int iBit = 0;iBit < 60;iBit++) {
number[iBit] = X % 2;
X /= 2;
}
int it = 0;
for(int pos = 0;pos < N/3;pos++) {
for(int iMotif = 0;iMotif < 8;iMotif++) {
bool estValide = true;
for(int iBit = 0;iBit < 3;iBit++)
if(broken[3 * pos + iBit] == 1 && motifs[iMotif][iBit] == 1)
estValide = false;
for(int iBit = 0;iBit < reponses[iMotif].size();iBit++)
if(reponses[iMotif][iBit] != number[it + iBit])
estValide = false;
if(estValide) {
for(int iBit = 0;iBit < 3;iBit++) {
Set(3 * pos + iBit, motifs[iMotif][iBit]);
}
it += reponses[iMotif].size();
break;
}
}
}
for(int iBit = 3 * (N / 3);iBit < N;iBit++) {
Set(iBit, 0);
}
}
#include <iostream>
#include <vector>
#include "Brunolib.h"
using namespace std;
vector<vector<int>> motifs = {
{1, 1, 1},
{1, 1, 0},
{0, 1, 1},
{0, 0, 1},
{1, 0, 1},
{0, 1, 0},
{1, 0, 0},
{0, 0, 0}
};
vector<vector<int>> reponses = {
{1, 1},
{1, 0},
{0, 1},
{0, 0},
{1},
{1},
{0},
{}
};
long long Bruno(int N, int A[]) {
long long X = 0, exp = 1;
for(int pos = 0;pos < N / 3;pos++) {
for(int iMotif = 0;iMotif < 8;iMotif++) {
bool estValide = true;
for(int iBit = 0;iBit < 3;iBit++)
if(A[3 * pos + iBit] != motifs[iMotif][iBit])
estValide = false;
if(estValide) {
for(int bit : reponses[iMotif]) {
X += bit * exp;
exp *= 2;
}
}
}
}
return X;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |