# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1039504 | juicy | Broken Device (JOI17_broken_device) | C++17 | 28 ms | 3028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
void set(int i, string s) {
for (auto j : {0, 1, 2}) {
Set(i + j, s[j] - '0');
}
}
void msg(int i, int type) {
if (type == 0) {
set(i, "000");
} else if (type == 1) {
set(i, "011");
} else if (type == 2) {
set(i, "101");
} else if (type == 3) {
set(i, "111");
} else if (type == 4) {
set(i, "100");
} else if (type == 5) {
set(i, "001");
} else {
set(i, "010");
}
}
int conv(string s) {
if (s == "10") {
return 1;
}
if (s == "01") {
return 2;
}
return 3;
}
}
void Anna(int N, long long X, int K, int *P) {
vector<bool> broke(N);
for (int i = 0; i < K; ++i) {
broke[P[i]] = 1;
}
int ptr = 0;
for (int i = 0; i < N; i += 3) {
if (ptr == 60) {
msg(i, 0);
}
int cnt = 0;
for (auto j : {0, 1, 2}) {
cnt += broke[i + j];
}
if (cnt > 1) {
msg(i, 0);
} else if (cnt == 1) {
string m;
m += (X >> ptr++ & 1) + '0';
msg(i, conv(m));
} else {
int c = X >> ptr++ & 1;
if (c == 0) {
msg(i, 6);
} else {
msg(i, broke[i] ? 5 : 4);
}
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
string decode(string m) {
if (m == "000") {
return "";
}
if (m == "011") {
return "10";
}
if (m == "101") {
return "01";
}
if (m == "111") {
return "11";
}
if (m == "100" || m == "001") {
return "1";
}
return "0";
}
}
long long Bruno(int N, int *A) {
string S;
for (int i = 0; i < N; i += 3) {
string m;
for (auto j : {0, 1, 2}) {
m += A[i + j] + '0';
}
S += decode(m);
}
long long res = 0;
for (int i = 0; i < 60; ++i) {
if (S[i] == '1') {
res += 1LL << i;
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |