# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1262284 | miniob | Broken Device (JOI17_broken_device) | C++20 | 51 ms | 1344 KiB |
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
long long los[157];
long long bity[60];
long long dosta[60];
int ileju = 0;
void add(long long x)
{
long long mojamaska = (long long)1 << ileju;
ileju++;
for (int i = 59; i >= 0; i--)
{
if ((x >> i) & 1)
{
if (!bity[i])
{
bity[i] = x;
dosta[i] = mojamaska;
return;
}
x ^= bity[i];
mojamaska ^= dosta[i];
}
}
}
vector<long long> dajpod(long long x)
{
long long curmaska = 0;
for (long long i = 59; i >= 0; i--)
{
if ((x >> i) & 1)
{
if (!bity[i])
{
return {};
}
x ^= bity[i];
curmaska ^= dosta[i];
}
}
vector<long long> odp;
for (long long i = 0; i < ileju; i++)
{
if ((curmaska >> i) & (long long)1)
{
odp.push_back(i);
}
}
return odp;
}
void Anna( int N, long long X, int K, int P[] ){
srand(N);
set<long long> nie;
for(long long i = 0; i < K; i++)
{
nie.insert(P[i]);
}
for(long long i = 0; i < 150; i++)
{
los[i] = rand() % (long long)(1100000000000000001);
if(nie.find(i) == nie.end())
{
add(los[i]);
}
}
vector<long long> git = dajpod(X);
set<long long> jedyn;
for(auto x : git)
{
jedyn.insert(x);
}
for(long long i = 0; i < 150; i++)
{
if(jedyn.find(i) != jedyn.end())
{
Set(i, 1);
}
else
{
Set(i, 0);
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long los[157];
long long Bruno( int N, int A[] ){
srand(N);
long long odp = 0;
for(int i = 0; i < 150; i++)
{
los[i] = rand() % (long long)(1100000000000000001);
}
for(int i = 0; i < N; i++)
{
if(A[i])
{
odp ^= los[i];
}
}
return odp;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |