Submission #21035

# Submission time Handle Problem Language Result Execution time Memory
21035 2017-03-30T21:05:18 Z sbansalcs Broken Device (JOI17_broken_device) C++14
Compilation error
0 ms 0 KB
#include "Annalib.h"
#include <stack>
#include <vector>
#include <assert.h>
const int N = 155;
int arr[N];
int arr2[N];
void Anna( int N, long long X, int K, int P[] ){
	long long X2=X;
	vector<int> vt;
	stack<int> st;

	for(int i=0;i<N;i++)	{
		arr[i]=0,arr2[i]=0;
	}
	for(int i=0;i<60;i++)	{
		st.push(X2%2);
		X2/=2;
	}
	for(int i=0;i<K;i++)	{
		arr2[P[i]]=1;
	}
	int i=0;
	int cnt=0;
	while(i+3<N)	{
		bool poss=1;
		for(int j=i;j<=i+3;j++)	{
			if(arr2[j])	poss=0;
		}
		if(poss)	{
			cnt++;
			vt.push(i);
		}
		assert(cnt>=20);
	}




  for( int i = 0; i < N; i++ ){
    Set( i, arr[i]);
  }
}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
  return 0LL;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:10:2: error: 'vector' was not declared in this scope
  vector<int> vt;
  ^
Anna.cpp:10:2: note: suggested alternative:
In file included from /usr/include/c++/5/vector:64:0,
                 from Anna.cpp:3:
/usr/include/c++/5/bits/stl_vector.h:214:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
Anna.cpp:10:9: error: expected primary-expression before 'int'
  vector<int> vt;
         ^
Anna.cpp:11:2: error: 'stack' was not declared in this scope
  stack<int> st;
  ^
Anna.cpp:11:2: note: suggested alternative:
In file included from /usr/include/c++/5/stack:61:0,
                 from Anna.cpp:2:
/usr/include/c++/5/bits/stl_stack.h:99:11: note:   'std::stack'
     class stack
           ^
Anna.cpp:11:8: error: expected primary-expression before 'int'
  stack<int> st;
        ^
Anna.cpp:17:3: error: 'st' was not declared in this scope
   st.push(X2%2);
   ^
Anna.cpp:32:4: error: 'vt' was not declared in this scope
    vt.push(i);
    ^