# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115891 | aminra | Broken Device (JOI17_broken_device) | C++14 | 77 ms | 3328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)153;
const int infint = (int)1e9 + 3;
const ll inf = (ll)1e18;
int ans[MAXN], bad[MAXN];
void build(int i, int b1, int b2, int b3)
{
ans[i] = b1, ans[i + 1] = b2, ans[i + 2] = b3;
return;
}
void Anna(int N, ll X, int k, int P[])
{
memset(bad, 0, sizeof bad);
memset(ans, 0, sizeof ans);
for (int i = 0; i < k; i++)
bad[P[i]] = 1;
for (int i = 0; i < N; i += 3)
{
if(bad[i] + bad[i + 1] + bad[i + 2] > 1)
{
build(i, 0, 0, 0);
continue;
}
if(bad[i] + bad[i + 1] + bad[i + 2] == 0)
{
if(X % 4 == 0)
build(i, 1, 0, 0);
if(X % 4 == 1)
build(i, 0, 1, 1);
if(X % 4 == 2)
build(i, 1, 0, 1);
if(X % 4 == 3)
build(i, 1, 1, 1);
X /= 4;
continue;
}
if(bad[i + 1] == 0)
{
if(X % 2 == 0)
build(i, 0, 1, 0);
else
if(bad[i + 2] == 0)
build(i, 0, 0, 1);
else
build(i, 1, 1, 0);
X /= 2;
continue;
}
else
{
if(X % 2 == 0)
build(i, 0, 0, 1), X /= 2;
else
if(X % 4 == 0)
build(i, 1, 0, 0), X /= 4;
else
build(i, 1, 0, 1), X /= 4;
}
}
for (int i = 0; i < N; i++)
Set(i, ans[i]);
}
/*int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}*/
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)153;
const int infint = (int)1e9 + 3;
const ll inf = (ll)1e18;
ll Bruno(int N, int A[])
{
ll ans = 0;
for (int i = N - 3; i >= 0; i -= 3)
if(A[i] == 0 && A[i + 1] == 0 && A[i + 2] == 0)
continue;
else
if(A[i] == 1 && A[i + 1] == 0 && A[i + 2] == 0)
ans = 1LL * ans * 4;
else
if(A[i] == 0 && A[i + 1] == 1 && A[i + 2] == 1)
ans = 1LL * ans * 4 + 1;
else
if(A[i] == 1 && A[i + 1] == 0 && A[i + 2] == 1)
ans = 1LL * ans * 4 + 2;
else
if(A[i] == 1 && A[i + 1] == 1 && A[i + 2] == 1)
ans = 1LL * ans * 4 + 3;
else
if(A[i] == 0 && A[i + 1] == 0 && A[i + 2] == 1)
ans = 1LL * ans * 2 + 1;
else
if(A[i] == 0 && A[i + 1] == 1 && A[i + 2] == 0)
ans = 1LL * ans * 2;
else
ans = 1LL * ans * 2 + 1;
return ans;
}
/*int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |