Submission #518722

#TimeUsernameProblemLanguageResultExecution timeMemory
518722LucaIlieHidden Sequence (info1cup18_hidden)C++17
59 / 100
96 ms292 KiB
#include <iostream> #include <vector> #include "grader.h" using namespace std; vector <int> vans; vector <int> seq; bool ask( int nr0, int nr1, int s ) { int i; seq.clear(); if ( nr0 + nr1 == 0 ) return 1; for ( i = 0; i < nr1; i++ ) seq.push_back( 1^s ); for ( i = 0; i < nr0; i++ ) seq.push_back( 0^s ); return isSubsequence( seq ); } void add( int b, int x ) { int i; for ( i = 0; i < x; i++ ) vans.push_back( b ); } vector <int> findSequence( int n ) { int nr0, nr1, s, zero, ram0, i; nr0 = 0; while ( nr0 <= n / 2 + 1 && ask( nr0, 0, 0 ) ) nr0++; nr0--; if ( nr0 == n / 2 + 1 ) { while ( !ask( 0, n - nr0, 0 ) ) nr0++; nr1 = nr0; nr0 = n - nr0; s = 1; } else { nr1 = n - nr0; s = 0; } ram0 = nr0; for ( i = 1; i <= nr1; i++ ) { zero = 0; while ( zero <= nr0 && ask( zero, i, s ) ) zero++; zero--; add( s, ram0 - zero ); ram0 = zero; add( !s, 1 ); } add( s, ram0 ); return vans; }

Compilation message (stderr)

grader.cpp: In function 'int main()':
grader.cpp:28:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   28 |     fprintf (fifo_out, "%d\n", ans.size ());
      |                         ~^     ~~~~~~~~~~~
      |                          |              |
      |                          int            std::vector<int>::size_type {aka long unsigned int}
      |                         %ld
grader.cpp:29:20: 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=0; i<ans.size () && i < N; i++)
      |                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...