# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
561952 | aryan12 | Broken Device (JOI17_broken_device) | C++17 | 47 ms | 2464 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 < 122; i += 2)
{
long long bit_set = (1LL << cnt) & X;
// cout << "bit_set = " << bit_set << "\n";
cnt++;
if(already_taken.count(i) || already_taken.count(i + 1))
{
cnt--;
Set(i, 0);
Set(i + 1, 0);
// cout << "nothing: 00\n";
}
else if(bit_set != 0 && !already_taken.count(i))
{
Set(i, 1);
Set(i + 1, 0);
// cout << "10\n";
}
else if(bit_set != 0 && !already_taken.count(i + 1))
{
Set(i, 0);
Set(i + 1, 1);
// cout << "01\n";
}
else
{
Set(i, 1);
Set(i + 1, 1);
// cout << "11\n";
}
}
for(long long i = 122; i < 150; i++)
{
Set(i, 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";
// cout << "\n\n\n\n\n\n\n\n\n\n\n\n BRUNO TURN\n";
long long ans = 0, cur_bit = 0;
for(int i = 0; i < 122; i += 2)
{
// cout << "received: " << A[i] << " " << A[i + 1] << "\n";
if(A[i] == 0 && A[i + 1] == 0)
{
continue;
}
if(A[i] == 0 || A[i + 1] == 0)
{
// cout << "cur_bit = " << cur_bit << "\n";
ans += (1LL << cur_bit);
// cout << "ans = " << ans << "\n";
}
cur_bit++;
}
// cout << "ans = " << ans << "\n";
// cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
// assert(ans % 2 == 0);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |