Submission #1077335

# Submission time Handle Problem Language Result Execution time Memory
1077335 2024-08-27T05:30:52 Z LCJLY Broken Device (JOI17_broken_device) C++14
55 / 100
214 ms 2692 KB
#include "Annalib.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
 
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii; 
 
void Anna(int n, long long val, int k, int p[]){
	bool amos[155];
	memset(amos,0,sizeof(amos));
	for(int x=0;x<k;x++){
		amos[p[x]]=true;
	}
	
	deque<int>v;
	for(int x=0;x<60;x++){
		if(val&(1LL<<x)) v.push_back(1);
		else v.push_back(0);
	}
	
	int ptr=0;
	
	int st=0;
	for(;st<n;st++){
		if(ptr==8) break;
		if(ptr<(int)8&&st+1<n&&!amos[st]&&!amos[st+1]){
			ptr++;
			st+=1;
		}
		
	}
	ptr=0;
	
	
	
	pii maxi={-1,-1};
	for(int x=1;x<n;x++){
		//if(60%x!=0) continue;
		int bit=0;
		for(int y=st;y<n;y++){
			if(ptr<(int)v.size()&&y+x<n){
				bool ok=true;
				for(int i=0;i<=x;i++){
					if(amos[y+i]) ok=false;
				}
				if(ok){
					bit+=x;
					y+=x;
				}
			}
		}
		maxi=max(maxi,{bit,x});
	}
	
	for(int i=7;i>=0;i--){
		if(maxi.second&(1<<i)){
			v.push_front(1);
		}
		else v.push_front(0);
	}
	
	int x=0;
	vector<int>done;
	for(;x<n;x++){
		if(ptr==8) break;
		if(ptr<(int)8&&x+1<n&&!amos[x]&&!amos[x+1]){
			Set(x,1);
			Set(x+1,v[ptr]);
			ptr++;
			x+=1;
		}
		else Set(x,0);
	}
	
	for(;x<n;x++){
		if(ptr<(int)v.size()&&x+maxi.second<n){
			bool ok=true;
			for(int i=0;i<=maxi.second;i++){
				if(amos[x+i]) ok=false;
			}
			if(ok){
				Set(x,1);
				for(int i=0;i<maxi.second;i++){
					if(ptr==(int)v.size()) Set(x+i+1,0);
					else{
						Set(x+i+1,v[ptr]);
						ptr++;
					}
				}
				x+=maxi.second;
			}
			else Set(x,0);
		}
		else Set(x,0);
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
 
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii; 
 
long long Bruno(int n, int a[]){
	long long val=0;
	int cur=0;
	//for(int x=0;x<n;x++) cout << a[x] << " ";
	//cout << endl;
	//for(int x=0;x<n;x++){
		//if(a[x]==1){
			//if(a[x+1]==1){
				//val+=1LL<<cur;
			//}
			//cur++;
			//if(a[x+2]==1){
				//val+=1LL<<cur;
			//}
			//cur++;
			//if(a[x+3]==1){
				//val+=1LL<<cur;
			//}
			//cur++;
			//x+=3;
		//}
	//}
	
	int x=0;
	int base=0;
	//int cnt=0;
	for(;x<n;x++){
		if(cur==8) break;
		if(a[x]==1){
			if(a[x+1]==1){
				base+=1LL<<cur;
			}
			cur++;
			x++;
		}
	}
	//show(base,base);
	
	cur=0;
	for(;x<n;x++){
		if(a[x]==1){
			for(int y=0;y<base;y++){
				if(x+y+1>=n) break;
				if(a[x+y+1]==1){
					val+=1LL<<cur;
				}	
				cur++;
			}
			x+=base;
		}
	}
	
	//for(int x=0;x<n;x++){
		//cout << a[x] << " ";
	//}
	//cout << " a\n";
	//cout << "check" << endl;
	return val;
}
# Verdict Execution time Memory Grader output
1 Partially correct 131 ms 2304 KB Output is partially correct - L* = 24
2 Partially correct 132 ms 2504 KB Output is partially correct - L* = 22
3 Partially correct 139 ms 2436 KB Output is partially correct - L* = 24
4 Partially correct 177 ms 2600 KB Output is partially correct - L* = 23
5 Partially correct 128 ms 2556 KB Output is partially correct - L* = 24
6 Partially correct 178 ms 2444 KB Output is partially correct - L* = 24
7 Partially correct 130 ms 2296 KB Output is partially correct - L* = 24
8 Partially correct 137 ms 2420 KB Output is partially correct - L* = 24
9 Partially correct 141 ms 2304 KB Output is partially correct - L* = 24
10 Partially correct 151 ms 2288 KB Output is partially correct - L* = 24
11 Partially correct 131 ms 2300 KB Output is partially correct - L* = 26
12 Partially correct 136 ms 2388 KB Output is partially correct - L* = 24
13 Partially correct 145 ms 2300 KB Output is partially correct - L* = 23
14 Partially correct 159 ms 2300 KB Output is partially correct - L* = 23
15 Partially correct 166 ms 2464 KB Output is partially correct - L* = 24
16 Partially correct 143 ms 2476 KB Output is partially correct - L* = 25
17 Partially correct 142 ms 2472 KB Output is partially correct - L* = 26
18 Partially correct 133 ms 2300 KB Output is partially correct - L* = 24
19 Partially correct 214 ms 2456 KB Output is partially correct - L* = 23
20 Partially correct 132 ms 2300 KB Output is partially correct - L* = 24
21 Partially correct 135 ms 2316 KB Output is partially correct - L* = 24
22 Partially correct 140 ms 2504 KB Output is partially correct - L* = 25
23 Partially correct 130 ms 2552 KB Output is partially correct - L* = 23
24 Partially correct 132 ms 2456 KB Output is partially correct - L* = 23
25 Partially correct 131 ms 2452 KB Output is partially correct - L* = 24
26 Partially correct 136 ms 2692 KB Output is partially correct - L* = 24
27 Partially correct 133 ms 2300 KB Output is partially correct - L* = 23
28 Partially correct 132 ms 2412 KB Output is partially correct - L* = 23
29 Partially correct 135 ms 2300 KB Output is partially correct - L* = 25
30 Partially correct 129 ms 2296 KB Output is partially correct - L* = 24
31 Partially correct 126 ms 2300 KB Output is partially correct - L* = 22
32 Partially correct 147 ms 2300 KB Output is partially correct - L* = 24
33 Partially correct 131 ms 2304 KB Output is partially correct - L* = 23
34 Partially correct 135 ms 2336 KB Output is partially correct - L* = 22
35 Partially correct 129 ms 2380 KB Output is partially correct - L* = 24
36 Partially correct 147 ms 2504 KB Output is partially correct - L* = 23
37 Partially correct 126 ms 2556 KB Output is partially correct - L* = 23
38 Partially correct 137 ms 2472 KB Output is partially correct - L* = 23
39 Partially correct 127 ms 2296 KB Output is partially correct - L* = 25
40 Partially correct 130 ms 2300 KB Output is partially correct - L* = 24