# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1077829 | veehj | Broken Device (JOI17_broken_device) | C++17 | 2 ms | 1208 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
void set3(int id, int a, int b, int c){
Set(id, a);
Set(id+1, b);
Set(id+2, c);
}
void Anna( int N, long long X, int K, int P[] ){
ll curr=X;
set<int> er;
for(int i=0; i<K; i++) er.insert(P[i]);
for(int i=0; i<N; i+=3){
if(er.count(i)+er.count(i+1)+er.count(i+2)>=2 || curr==0){
set3(i, 0, 0, 0); //0->
continue;
}
if(!(er.count(i) || er.count(i+1) || er.count(i+2))){
if(curr%4==0) set3(i, 1, 0, 0); //4->00
if(curr%4==1) set3(i, 1, 0, 1); //5->01
if(curr%4==2) set3(i, 1, 1, 0); //6->10
if(curr%4==3) set3(i, 1, 1, 1); //7->11
curr/=4;
continue;
}
if(curr%2){
if(er.count(i+2)) set3(i, 0, 1, 1); //3->1
else set3(i, 0, 0, 1); //1->1
curr/=2;
} else {
if(er.count(i+1)){
if(curr%4==0) set3(i, 1, 0, 0); //4->00
if(curr%4==1) set3(i, 1, 0, 1); //5->01
curr/=4;
} else {
set3(i, 0, 1, 0); //2->0
curr/=2;
}
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
long long Bruno( int N, int A[] ){
ll ans=0;
for(int i=0; i<N; i+=3){
int nw=A[i]*4+A[i+1]*2+A[i+2];
if(nw==0) continue;
if(nw==1) ans*=4;
if(nw==2) ans*=2;
if(nw==3) ans=ans*2+1;
if(nw==4) ans=ans*2+1;
if(nw==5) ans=ans*4+1;
if(nw==6) ans=ans*4+2;
if(nw==7) ans=ans*4+3;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |