Submission #561518

# Submission time Handle Problem Language Result Execution time Memory
561518 2022-05-13T04:07:42 Z amunduzbaev Broken Device (JOI17_broken_device) C++17
0 / 100
1 ms 468 KB
#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;

void Anna(int n, long long x, int k, int p[]){
	vector<int> used(n);
	for(int i=0;i<k;i++) used[p[i]] = 1;
	int bit = -1;
	for(int i=1;i<n;i++){
		if(!used[i] && !used[i-1]){
			used[i] = used[i-1] = 1;
			bit = i; break;
		}
	}
	
	vector<int> pos;
	for(int i=1;i<k;i++){
		pos.push_back(p[i] - p[i-1] - 1);
	}
	pos.push_back(p[0]);
	pos.push_back(n - p[k - 1] - 1);
	int b = -1;
	for(int i=1;i<=2;i++){
		int cnt = 0;
		for(auto x : pos){
			cnt += (x / (i + 1));
		}
		
		if(cnt >= 60 / i){
			b = i;
		}
	}
	if(!(~b)){
		for(int i=0;i<n;i++) Set(i, 0);
		assert(false);
	}
	
	for(int i=0;i<k;i++) Set(p[i], 0);
	if(b > 1) Set(bit - 1, 1), Set(bit, 1);
	else Set(bit - 1, 1), Set(bit, 0);
	int l = 0;
	for(int i=0;i<60;i+=b){
		while(l<n){
			int ok = 1;
			for(int k=0;k<=b;k++){
				if(l < k) ok = 0;
				else if(used[l - k]) ok = 0;
			}
			
			if(ok) break;
			l++;
		}
		
		assert(l<n);
		for(int j=b - 1;~j;j--){
			Set(l - j, x & 1);
			used[l - j] = 1;
			x >>= 1;
		}
		
		used[l - b] = 1;
		Set(l - b, 1);
	}
	
	for(int i=0;i<n;i++){
		if(!used[i]){
			Set(i, 0);
		}
	}
}


/*

2
150 14 1
2
150 9 2
0 1

*/
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;

long long Bruno( int n, int a[] ){
	int b = 1, l = -1;
	for(int i=0;i<n;i++){
		if(!a[i]) continue;
		if(a[i]){
			b += a[i + 1];
			l = i + 2;
			break;
		}
	}
	
	assert(~l);
	int bit = 0;
	long long x = 0;
	for(int i=l;i<n;i++){
		if(a[i]){
			for(int j=i+1;j<=i+b && bit < 60;j++){
				x |= ((a[j] * 1ll) << bit);
				bit++;
			}
			
			i += b;
		}
	}
	
	//~ cout<<x<<endl;
	return x;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Runtime error 1 ms 468 KB Execution killed with signal 6
4 Runtime error 1 ms 468 KB Execution killed with signal 6
5 Runtime error 1 ms 448 KB Execution killed with signal 6
6 Runtime error 1 ms 468 KB Execution killed with signal 6
7 Runtime error 1 ms 468 KB Execution killed with signal 6
8 Runtime error 1 ms 468 KB Execution killed with signal 6
9 Runtime error 1 ms 468 KB Execution killed with signal 6
10 Runtime error 1 ms 468 KB Execution killed with signal 6
11 Runtime error 1 ms 468 KB Execution killed with signal 6
12 Runtime error 1 ms 468 KB Execution killed with signal 6
13 Runtime error 1 ms 468 KB Execution killed with signal 6
14 Runtime error 1 ms 468 KB Execution killed with signal 6
15 Runtime error 1 ms 468 KB Execution killed with signal 6
16 Runtime error 1 ms 468 KB Execution killed with signal 6
17 Runtime error 1 ms 468 KB Execution killed with signal 6
18 Runtime error 1 ms 468 KB Execution killed with signal 6
19 Runtime error 1 ms 468 KB Execution killed with signal 6
20 Runtime error 1 ms 468 KB Execution killed with signal 6
21 Runtime error 1 ms 468 KB Execution killed with signal 6
22 Runtime error 1 ms 468 KB Execution killed with signal 6
23 Runtime error 1 ms 468 KB Execution killed with signal 6
24 Runtime error 1 ms 452 KB Execution killed with signal 6
25 Runtime error 1 ms 468 KB Execution killed with signal 6
26 Runtime error 1 ms 468 KB Execution killed with signal 6
27 Runtime error 1 ms 468 KB Execution killed with signal 6
28 Runtime error 1 ms 452 KB Execution killed with signal 6
29 Runtime error 1 ms 468 KB Execution killed with signal 6
30 Runtime error 1 ms 468 KB Execution killed with signal 6
31 Runtime error 1 ms 448 KB Execution killed with signal 6
32 Runtime error 1 ms 468 KB Execution killed with signal 6
33 Runtime error 1 ms 468 KB Execution killed with signal 6
34 Runtime error 1 ms 468 KB Execution killed with signal 6
35 Runtime error 1 ms 468 KB Execution killed with signal 6
36 Runtime error 1 ms 468 KB Execution killed with signal 6
37 Runtime error 1 ms 468 KB Execution killed with signal 6
38 Runtime error 1 ms 468 KB Execution killed with signal 6
39 Runtime error 1 ms 468 KB Execution killed with signal 6
40 Runtime error 1 ms 468 KB Execution killed with signal 6