Submission #345840

# Submission time Handle Problem Language Result Execution time Memory
345840 2021-01-08T09:37:48 Z kshitij_sodani Broken Device (JOI17_broken_device) C++14
55 / 100
44 ms 2820 KB
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#define endl '\n'

#include "Annalib.h"
int vis[151];
int ans[151];
void Anna( int n, long long x, int k, int pp[] ){
	for(int i=0;i<n;i++){
		vis[i]=0;
		ans[i]=0;
	}
	for(int i=0;i<k;i++){
		vis[pp[i]]=1;		
	}
	int cur=-1;

	for(int i=0;i<n;i++){
		if(cur==60){
			break;
		}
		if(vis[i]==0){
			if(cur==-1){
				if(i%2==0){
					ans[i]=1;
					cur++;
				}
				continue;
			}
			if(x&(1LL<<cur)){
				if(i%2==1){
					ans[i]=1;
					cur++;
				}
			}
			else{
				if(i%2==0){
					ans[i]=1;
					cur++;
				}
			}
		}
	}
	if(cur==60){
		 for( int i = 0; i < n; i++ ){
	   		 Set( i, ans[i] );
	  	}



	  	return;

	}
	cur=-1;
	for(int i=0;i<n;i++){
		ans[i]=0;
	}
	for(int i=0;i<n;i++){
		if(cur==60){
			break;
		}
		if(vis[i]==0){
			if(cur==-1){
				if(i%2==1){
					cur++;
					ans[i]=1;
				}
				continue;
			}
			if(x&(1LL<<cur)){
				if(i%2==0){
					ans[i]=1;
					cur++;
				}
			}
			else{
				if(i%2==1){
					ans[i]=1;
					cur++;
				}
			}
		}
	}

	 for( int i = 0; i < n; i++ ){
	   		 Set( i, ans[i] );
	  	}

	 
}
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#define endl '\n'


#include "Brunolib.h"

long long Bruno( int n, int aa[] ){


	vector<int> ss;
	llo ans=0;
	int x=-1;
	for(int i=0;i<n;i++){
		if(aa[i]==1){
			if(x==-1){
				x=i;
				continue;
			}
			ss.pb(i);
		}
	}
	if(x%2==0){
		for(int i=0;i<ss.size();i++){
			if((ss[i]%2==1)){
				ans+=(1LL<<i);
			}
		}
	}
	else{
		for(int i=0;i<ss.size();i++){
			if((ss[i]%2==0)){
				ans+=(1LL<<i);
			}
		}
	}




  return ans;
}

//g++ -std=c++14 -O2 -o aa grader.cpp Anna.cpp Bruno.cpp

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i=0;i<ss.size();i++){
      |               ~^~~~~~~~~~
Bruno.cpp:37:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i=0;i<ss.size();i++){
      |               ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 42 ms 2700 KB Output is partially correct - L* = 31
2 Partially correct 42 ms 2492 KB Output is partially correct - L* = 30
3 Partially correct 43 ms 2492 KB Output is partially correct - L* = 26
4 Partially correct 44 ms 2620 KB Output is partially correct - L* = 29
5 Partially correct 42 ms 2492 KB Output is partially correct - L* = 31
6 Partially correct 41 ms 2732 KB Output is partially correct - L* = 28
7 Partially correct 42 ms 2620 KB Output is partially correct - L* = 33
8 Partially correct 42 ms 2620 KB Output is partially correct - L* = 29
9 Partially correct 42 ms 2700 KB Output is partially correct - L* = 29
10 Partially correct 42 ms 2492 KB Output is partially correct - L* = 30
11 Partially correct 42 ms 2620 KB Output is partially correct - L* = 27
12 Partially correct 42 ms 2620 KB Output is partially correct - L* = 33
13 Partially correct 42 ms 2620 KB Output is partially correct - L* = 31
14 Partially correct 42 ms 2692 KB Output is partially correct - L* = 30
15 Partially correct 41 ms 2648 KB Output is partially correct - L* = 33
16 Partially correct 44 ms 2492 KB Output is partially correct - L* = 32
17 Partially correct 42 ms 2740 KB Output is partially correct - L* = 29
18 Partially correct 42 ms 2492 KB Output is partially correct - L* = 32
19 Partially correct 42 ms 2620 KB Output is partially correct - L* = 29
20 Partially correct 42 ms 2692 KB Output is partially correct - L* = 29
21 Partially correct 42 ms 2492 KB Output is partially correct - L* = 32
22 Partially correct 42 ms 2492 KB Output is partially correct - L* = 30
23 Partially correct 42 ms 2648 KB Output is partially correct - L* = 32
24 Partially correct 42 ms 2620 KB Output is partially correct - L* = 31
25 Partially correct 43 ms 2620 KB Output is partially correct - L* = 22
26 Partially correct 43 ms 2700 KB Output is partially correct - L* = 29
27 Partially correct 42 ms 2492 KB Output is partially correct - L* = 32
28 Partially correct 44 ms 2620 KB Output is partially correct - L* = 33
29 Partially correct 42 ms 2700 KB Output is partially correct - L* = 31
30 Partially correct 42 ms 2492 KB Output is partially correct - L* = 31
31 Partially correct 42 ms 2700 KB Output is partially correct - L* = 32
32 Partially correct 42 ms 2692 KB Output is partially correct - L* = 35
33 Partially correct 42 ms 2492 KB Output is partially correct - L* = 30
34 Partially correct 41 ms 2692 KB Output is partially correct - L* = 33
35 Partially correct 42 ms 2492 KB Output is partially correct - L* = 30
36 Partially correct 42 ms 2492 KB Output is partially correct - L* = 29
37 Partially correct 42 ms 2700 KB Output is partially correct - L* = 31
38 Partially correct 41 ms 2620 KB Output is partially correct - L* = 25
39 Partially correct 41 ms 2820 KB Output is partially correct - L* = 32
40 Partially correct 42 ms 2492 KB Output is partially correct - L* = 31