# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
231896 | jiahng | Broken Device (JOI17_broken_device) | C++17 | 62 ms | 3312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 151
void Anna(int N, long long X, int K, int P[]){
bool broken[maxn];
FOR(i,0,N-1) broken[i] = 0;
FOR(i,0,K-1) broken[P[i]] = 1;
int idx = 0;
for (int i = 0; i < 150; i += 3){
int num = 0;
bool A[3];
A[0] = A[1] = A[2] = 0;
FOR(j,i,i+2){
if (broken[j]){
A[j-i] = 1;
num++;
}
}
if (num > 1){
FOR(j,i,i+2) Set(j,0);
continue;
}else if (num == 1){
if ((X & (1<<idx)) == 1){
if (!A[2]){
Set(i,0); Set(i+1,0); Set(i+2,1);
}else{
Set(i,1); Set(i+1,1); Set(i+2,0);
}
idx++;
}else{
if (!A[1]){
Set(i,0); Set(i+1,1); Set(i+2,0);
idx++;
}else{
if (X & (1<<(idx+1)) == 1){
Set(i,0); Set(i+1,0); Set(i+2,1);
}else{
Set(i,1); Set(i+1,0); Set(i+2,1);
}
idx += 2;
}
}
}else{
string a = "";
if (X & (1<<idx) == 1) a += '1';
else a += '0';
if (X & (1<<(idx+1)) == 1) a += '1';
else a += '0';
if (a == "00"){
Set(i,1); Set(i+1,0); Set(i+2,1);
}else if (a == "01"){
Set(i,1); Set(i+1,0); Set(i+2,0);
}else if (a == "10"){
Set(i,0); Set(i+1,1); Set(i+2,1);
}else{
Set(i,1); Set(i+1,1); Set(i+2,1);
}
idx += 2;
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
long long Bruno(int N, int A[]){
string ans = "";
for (int i = 0; i < 150; i+=3){
string cur = "";
FOR(j,i,i+2){
if (A[j] == 1) cur += '1';
else cur += '0';
}
if (cur == "000") continue;
else if (cur == "001" || cur == "110") ans += '1';
else if (cur == "010") ans += '0';
else if (cur == "111") ans += "11";
else if (cur == "011") ans += "10";
else if (cur == "100") ans += "01";
else ans += "00";
}
ll lans = 0;
FOR(i,0,ans.size() - 1){
if (ans[i] == '1') lans |= (1<<i);
}
return lans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |