답안 #1113127

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113127 2024-11-15T20:07:43 Z ttamx Broken Device (JOI17_broken_device) C++17
100 / 100
56 ms 2784 KB
#include "Annalib.h"
#include<bits/stdc++.h>

using namespace std;

void Anna(int n,long long x,int k,int p[]){
	using ull = uint64_t;
	mt19937_64 rng(0);
	vector<ull> basis(64),way(64);
	vector<int> id(64,-1);
	auto add=[&](ull x,int i){
		ull w=0;
		for(int b=63;b>=0;b--){
			if(x>>b&1){
				if(id[b]==-1){
					basis[b]=x;
					way[b]=w|(1ULL<<b);
					id[b]=i;
					return;
				}
				x^=basis[b];
				w^=way[b];
			}
		}
	};
	vector<bool> ok(n,true);
	for(int i=0;i<k;i++){
		ok[p[i]]=false;
	}
	for(int i=0;i<n;i++){
		ull val=rng();
		if(ok[i]){
			add(val,i);
		}
	}
	vector<int> ans(n);
	ull w=0;
	for(int i=63;i>=0;i--){
		if(x>>i&1){
			x^=basis[i];
			w^=way[i];
		}
	}
	for(int i=63;i>=0;i--){
		if(w>>i&1){
			ans[id[i]]=1;
		}
	}
	for(int i=0;i<n;i++){
		Set(i,ans[i]);
	}
}
#include "Brunolib.h"
#include<bits/stdc++.h>

using namespace std;

long long Bruno(int n,int a[]){
	mt19937_64 rng(0);
	uint64_t ans=0;
	for(int i=0;i<n;i++){
		uint64_t val=rng();
		if(a[i]){
			ans^=val;
		}
	}
  	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 2636 KB Output is correct - L* = 40
2 Correct 48 ms 2576 KB Output is correct - L* = 40
3 Correct 49 ms 2364 KB Output is correct - L* = 40
4 Correct 46 ms 2512 KB Output is correct - L* = 40
5 Correct 47 ms 2612 KB Output is correct - L* = 40
6 Correct 49 ms 2632 KB Output is correct - L* = 40
7 Correct 50 ms 2592 KB Output is correct - L* = 40
8 Correct 49 ms 2620 KB Output is correct - L* = 40
9 Correct 49 ms 2596 KB Output is correct - L* = 40
10 Correct 45 ms 2612 KB Output is correct - L* = 40
11 Correct 47 ms 2624 KB Output is correct - L* = 40
12 Correct 47 ms 2496 KB Output is correct - L* = 40
13 Correct 46 ms 2540 KB Output is correct - L* = 40
14 Correct 56 ms 2480 KB Output is correct - L* = 40
15 Correct 47 ms 2620 KB Output is correct - L* = 40
16 Correct 47 ms 2620 KB Output is correct - L* = 40
17 Correct 46 ms 2624 KB Output is correct - L* = 40
18 Correct 49 ms 2632 KB Output is correct - L* = 40
19 Correct 50 ms 2632 KB Output is correct - L* = 40
20 Correct 50 ms 2616 KB Output is correct - L* = 40
21 Correct 49 ms 2612 KB Output is correct - L* = 40
22 Correct 48 ms 2496 KB Output is correct - L* = 40
23 Correct 53 ms 2612 KB Output is correct - L* = 40
24 Correct 45 ms 2612 KB Output is correct - L* = 40
25 Correct 47 ms 2624 KB Output is correct - L* = 40
26 Correct 48 ms 2620 KB Output is correct - L* = 40
27 Correct 53 ms 2636 KB Output is correct - L* = 40
28 Correct 49 ms 2620 KB Output is correct - L* = 40
29 Correct 47 ms 2612 KB Output is correct - L* = 40
30 Correct 48 ms 2784 KB Output is correct - L* = 40
31 Correct 53 ms 2612 KB Output is correct - L* = 40
32 Correct 47 ms 2360 KB Output is correct - L* = 40
33 Correct 46 ms 2356 KB Output is correct - L* = 40
34 Correct 49 ms 2636 KB Output is correct - L* = 40
35 Correct 46 ms 2316 KB Output is correct - L* = 40
36 Correct 49 ms 2612 KB Output is correct - L* = 40
37 Correct 50 ms 2612 KB Output is correct - L* = 40
38 Correct 47 ms 2612 KB Output is correct - L* = 40
39 Correct 48 ms 2364 KB Output is correct - L* = 40
40 Correct 46 ms 2632 KB Output is correct - L* = 40