제출 #67051

#제출 시각아이디문제언어결과실행 시간메모리
67051osmanorhanHidden Sequence (info1cup18_hidden)C++17
0 / 100
7 ms308 KiB
#include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <cmath> #include <climits> #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <cassert> #include <vector> #define all(x) x.begin() , x.end() #define fi first #define se second #define pb push_back #define umax( x , y ) x = max( x , (y) ) #define umin( x , y ) x = min( x , (y) ) #include "grader.h" using namespace std; bool asknum( int n, int a ) { vector<int> v; if( n <= a/2+1 ) { for(int i=1;i<=n;i++) v.pb( 1 ); return isSubsequence( v ); } else { for(int i=n;i<=a;i++) v.pb( 0 ); return !isSubsequence( v ); } return 0; } vector < int > findSequence (int a) { int bl = 0, pb = 0; int wh = a, pw = 0; while( bl < a && asknum(bl+1,a) ) bl++; vector < int > ans (a, 0); for(int i=0;i<a;i++) { if( !bl || !wh ) { if( bl ) ans[i] = 1, bl--; continue; } vector<int> v; if( bl+pw < wh+pb ) { v.pb( 0 ); for(int j=0;j<pw;j++) v.pb( 0 ); for(int j=0;j<bl;j++) v.pb( 1 ); if( isSubsequence( v ) ) ans[i] = 0; else ans[i] = 1; } else { v.pb( 1 ); for(int j=0;j<pb;j++) v.pb( 1 ); for(int j=0;j<wh;j++) v.pb( 0 ); if( isSubsequence( v ) ) ans[i] = 1; else ans[i] = 0; } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

grader.cpp: In function 'int main()':
grader.cpp:28:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fifo_out, "%d\n", ans.size ());
                                ~~~~~~~~~~~^
grader.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<ans.size () && i < N; i++)
                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...