답안 #1113124

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

using namespace std;

void Anna(int n,long long x,int k,int p[]){
	mt19937_64 rng(0);
	vector<uint64_t> basis(64),way(64);
	vector<int> id(64,-1);
	auto add=[&](uint64_t x,int i){
		uint64_t 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++){
		uint64_t val=rng();
		if(ok[i]){
			add(val,i);
		}
	}
	vector<int> ans(n);
	uint64_t 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 50 ms 2612 KB Output is correct - L* = 40
2 Correct 49 ms 2508 KB Output is correct - L* = 40
3 Correct 50 ms 2620 KB Output is correct - L* = 40
4 Correct 50 ms 2364 KB Output is correct - L* = 40
5 Correct 51 ms 2380 KB Output is correct - L* = 40
6 Correct 48 ms 2608 KB Output is correct - L* = 40
7 Correct 46 ms 2620 KB Output is correct - L* = 40
8 Correct 52 ms 2536 KB Output is correct - L* = 40
9 Correct 47 ms 2712 KB Output is correct - L* = 40
10 Correct 47 ms 2612 KB Output is correct - L* = 40
11 Correct 47 ms 2404 KB Output is correct - L* = 40
12 Correct 47 ms 2612 KB Output is correct - L* = 40
13 Correct 47 ms 2588 KB Output is correct - L* = 40
14 Correct 49 ms 2524 KB Output is correct - L* = 40
15 Correct 46 ms 2612 KB Output is correct - L* = 40
16 Correct 45 ms 2624 KB Output is correct - L* = 40
17 Correct 45 ms 2356 KB Output is correct - L* = 40
18 Correct 46 ms 2400 KB Output is correct - L* = 40
19 Correct 46 ms 2612 KB Output is correct - L* = 40
20 Correct 46 ms 2608 KB Output is correct - L* = 40
21 Correct 46 ms 2564 KB Output is correct - L* = 40
22 Correct 48 ms 2404 KB Output is correct - L* = 40
23 Correct 47 ms 2612 KB Output is correct - L* = 40
24 Correct 47 ms 2636 KB Output is correct - L* = 40
25 Correct 47 ms 2612 KB Output is correct - L* = 40
26 Correct 46 ms 2448 KB Output is correct - L* = 40
27 Correct 46 ms 2612 KB Output is correct - L* = 40
28 Correct 45 ms 2612 KB Output is correct - L* = 40
29 Correct 46 ms 2620 KB Output is correct - L* = 40
30 Correct 45 ms 2356 KB Output is correct - L* = 40
31 Correct 51 ms 2316 KB Output is correct - L* = 40
32 Correct 52 ms 2512 KB Output is correct - L* = 40
33 Correct 59 ms 2368 KB Output is correct - L* = 40
34 Correct 49 ms 2624 KB Output is correct - L* = 40
35 Correct 48 ms 2616 KB Output is correct - L* = 40
36 Correct 51 ms 2356 KB Output is correct - L* = 40
37 Correct 48 ms 2436 KB Output is correct - L* = 40
38 Correct 50 ms 2364 KB Output is correct - L* = 40
39 Correct 48 ms 2636 KB Output is correct - L* = 40
40 Correct 48 ms 2628 KB Output is correct - L* = 40