# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
561950 | aryan12 | Broken Device (JOI17_broken_device) | C++17 | 33 ms | 2968 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int N, long long X, int K, int P[])
{
set<int> already_taken;
for(int i = 0; i < K; i++)
{
already_taken.insert(P[i]);
}
long long cnt = 0;
// cout << "X = " << X << "\n";
for(long long i = 0; i < N / 2; i++)
{
long long bit_set = (1LL << cnt) & X;
// cout << "bit_set = " << bit_set << "\n";
cnt++;
if(bit_set == 0 && !already_taken.count(i * 2) && !already_taken.count(i * 2 + 1))
{
Set(i * 2, 1);
Set(i * 2 + 1, 1);
}
else if(bit_set != 0 && !already_taken.count(i * 2))
{
Set(i * 2, 1);
Set(i * 2 + 1, 0);
}
else if(bit_set != 0 && !already_taken.count(i * 2 + 1))
{
Set(i * 2, 0);
Set(i * 2 + 1, 1);
}
else
{
cnt--;
Set(i * 2, 0);
Set(i * 2 + 1, 0);
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno(int N, int A[])
{
// for(long long i = 0; i < N; i++)
// {
// cout << A[i] << " ";
// }
// cout << "\n";
long long ans = 0, cur_bit = 0;
for(int i = 0; i < N - 1; i += 2)
{
if(A[i] == 0 && A[i + 1] == 0)
{
continue;
}
if(A[i] == 0 || A[i + 1] == 0)
{
ans += (1LL << cur_bit);
}
cur_bit++;
}
// cout << "ans = " << ans << "\n";
assert(ans % 2 == 0);
return ans / 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |