답안 #345845

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345845 2021-01-08T09:46:41 Z kshitij_sodani Broken Device (JOI17_broken_device) C++14
0 / 100
2000 ms 492 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;		
	}
	vector<int> kk;
	for(int i=0;i<n;i++){
		if(vis[i]==0){
			kk.pb(i);
		}
	}
	int cot=0;
	while(cot<kk.size()){
		int cur=-1;
		int la=-1;
		for(int i=0;i<n;i++){
			ans[i]=0;
		}
		for(int i=0;i<n;i++){
			if(cur==60){
				break;
			}
			if(i<kk[cot]){
				continue;
			}
			if(vis[i]==0){
				if(cur==-1){
					ans[i]=1;
					cur++;
					la=i;
					continue;
					/*if(i%2==0){
						ans[i]=1;
						cur++;
					}*/
					continue;
				}
				if(x&(1LL<<cur)){
					if((i-la)%2==1){
						ans[i]=1;
						cur++;
						la=i;
					}
				}
				else{
					if((i-la)%2==0){
						ans[i]=1;
						cur++;
						la=i;
					}
				}
			}
		}
		if(cur==60){
			break;
		}
		//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);
		}
	}
	for(int i=1;i<ss.size();i++){
			if((ss[i]-ss[i-1])%2==1){
				ans+=(1LL<<(i-1));
			}
		}
	return ans;
	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

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:29:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  while(cot<kk.size()){
      |        ~~~^~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=1;i<ss.size();i++){
      |              ~^~~~~~~~~~
Bruno.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |   for(int i=0;i<ss.size();i++){
      |               ~^~~~~~~~~~
Bruno.cpp:43:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |   for(int i=0;i<ss.size();i++){
      |               ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2037 ms 364 KB Time limit exceeded
2 Execution timed out 2072 ms 364 KB Time limit exceeded
3 Execution timed out 2083 ms 364 KB Time limit exceeded
4 Execution timed out 2085 ms 364 KB Time limit exceeded
5 Execution timed out 2083 ms 364 KB Time limit exceeded
6 Execution timed out 2077 ms 364 KB Time limit exceeded
7 Execution timed out 2073 ms 364 KB Time limit exceeded
8 Execution timed out 2025 ms 364 KB Time limit exceeded
9 Execution timed out 2073 ms 364 KB Time limit exceeded
10 Execution timed out 2032 ms 364 KB Time limit exceeded
11 Execution timed out 2076 ms 364 KB Time limit exceeded
12 Execution timed out 2081 ms 364 KB Time limit exceeded
13 Execution timed out 2017 ms 364 KB Time limit exceeded
14 Execution timed out 2090 ms 364 KB Time limit exceeded
15 Execution timed out 2077 ms 364 KB Time limit exceeded
16 Execution timed out 2079 ms 364 KB Time limit exceeded
17 Execution timed out 2041 ms 364 KB Time limit exceeded
18 Execution timed out 2083 ms 364 KB Time limit exceeded
19 Execution timed out 2025 ms 364 KB Time limit exceeded
20 Execution timed out 2074 ms 364 KB Time limit exceeded
21 Execution timed out 2041 ms 364 KB Time limit exceeded
22 Execution timed out 2086 ms 364 KB Time limit exceeded
23 Execution timed out 2052 ms 364 KB Time limit exceeded
24 Execution timed out 2079 ms 364 KB Time limit exceeded
25 Execution timed out 2069 ms 364 KB Time limit exceeded
26 Execution timed out 2073 ms 364 KB Time limit exceeded
27 Execution timed out 2067 ms 364 KB Time limit exceeded
28 Execution timed out 2033 ms 364 KB Time limit exceeded
29 Execution timed out 2065 ms 364 KB Time limit exceeded
30 Execution timed out 2047 ms 364 KB Time limit exceeded
31 Execution timed out 2045 ms 364 KB Time limit exceeded
32 Execution timed out 2019 ms 364 KB Time limit exceeded
33 Execution timed out 2041 ms 364 KB Time limit exceeded
34 Execution timed out 2080 ms 364 KB Time limit exceeded
35 Execution timed out 2020 ms 492 KB Time limit exceeded
36 Execution timed out 2082 ms 364 KB Time limit exceeded
37 Execution timed out 2070 ms 364 KB Time limit exceeded
38 Execution timed out 2031 ms 364 KB Time limit exceeded
39 Execution timed out 2092 ms 364 KB Time limit exceeded
40 Execution timed out 2089 ms 364 KB Time limit exceeded