| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1319764 | PlayVoltz | Broken Device (JOI17_broken_device) | C++20 | 20 ms | 1572 KiB |
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second
void Anna(int n, long long x, int k, int p[]){
vector<bool> die(n, 0), res(n, 0);
for (int i=0; i<k; ++i)die[p[i]]=1;
long long b=0;
for (int i=0; i<n/3&&b<60; ++i){
if (b==59){
if ((1ll<<b)&x&&!die[i+2*n/3])res[i+2*n/3]=1, ++b;
else if (!((1ll<<b)&x)&&!die[i])res[i]=1, ++b;
continue;
}
bool done=0;
if (((1ll<<b)&x)&&((1ll<<(b+1))&x)){
if (!die[i+n/3]&&!die[i+2*n/3])res[i+n/3]=res[i+2*n/3]=1, b+=2, done=1;
}
else if (!((1ll<<b)&x)&&!((1ll<<(b+1))&x)){
if (!die[i+n/3]&&!die[i])res[i+n/3]=res[i]=1, b+=2, done=1;
}
else if (((1ll<<b)&x)&&!((1ll<<(b+1))&x)){
if (!die[i]&&!die[i+2*n/3])res[i]=res[i+2*n/3]=1, b+=2, done=1;
}
else if (!((1ll<<b)&x)&&((1ll<<(b+1))&x)){
if (!die[i+n/3])res[i+n/3]=1, b+=2, done=1;
}
if (!done){
if ((1ll<<b)&x&&!die[i+2*n/3])res[i+2*n/3]=1, ++b;
else if (!((1ll<<b)&x)&&!die[i])res[i]=1, ++b;
}
}
for (int i=0; i<n; ++i)Set(i, res[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second
long long Bruno(int n, int vect[]){
long long res=0, b=0;
for (int i=0; i<n/3&&b<60; ++i){
if (!vect[i]&&!vect[i+n/3]&&!vect[i+2*n/3])continue;
if (!vect[i]&&!vect[i+n/3]&&vect[i+2*n/3])res+=(1ll<<b), ++b;
if (vect[i]&&!vect[i+n/3]&&!vect[i+2*n/3])++b;
if (!vect[i]&&vect[i+n/3]&&!vect[i+2*n/3])res+=(1ll<<(b+1)), b+=2;
if (!vect[i]&&vect[i+n/3]&&vect[i+2*n/3])res+=(1ll<<b)+(1ll<<(b+1)), b+=2;
if (vect[i]&&!vect[i+n/3]&&vect[i+2*n/3])res+=(1ll<<b), b+=2;
if (vect[i]&&vect[i+n/3]&&!vect[i+2*n/3])b+=2;
}
return res;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
