Submission #67188

#TimeUsernameProblemLanguageResultExecution timeMemory
67188MrTEKHidden Sequence (info1cup18_hidden)C++14
100 / 100
14 ms568 KiB
#include<bits/stdc++.h> #include "grader.h" using namespace std; #define mp make_pair #define pb push_back #define len(a) (int)a.size() #define fi first #define sc second #define d1(w) cerr<<#w<<":"<<w<<endl; #define d2(w,c) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<endl; #define d3(w,c,z) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<" "<<#z<<":"<<z<<endl; #define left ind+ind #define right ind+ind+1 #define mid (l+r)/2 #define FAST_IO ios_base::sync_with_stdio(false); #define endl '\n' const int maxn = 620; const long long LINF = 1e18; const int LOG = 31; const int INF = 1e9; const int N = 1e3 + 5; const int M = 4; const int SQ = 350; const int MOD = 998244353; vector < int > findSequence (int N) { vector < int > ans (N, 0),v0,v1,v; int sif,bir,cnt_0 = 0,cnt_1 = 0; for (int i = 0 ; i < N ; i++) { v0.pb(0); v1.pb(1); if (isSubsequence(v0) == false) { sif = i; bir = N - sif; break; } else if(isSubsequence(v1) == false) { bir = i; sif = N - bir; break; } } for (int i = 0 ; i < N ; i++) { v.clear(); if (cnt_0 + 1 + bir - cnt_1 <= N / 2 + 1) { for (int i = 1 ; i <= cnt_0 + 1 ; i++) v.pb(0); for (int i = 1 ; i <= bir - cnt_1 ; i++) v.pb(1); if(isSubsequence(v)) cnt_0++,ans[i] = 0; else cnt_1++,ans[i] = 1; continue; } else { for (int i = 1 ; i <= cnt_1 + 1 ; i++) v.pb(1); for (int i = 1 ; i <= sif - cnt_0 ; i++) v.pb(0); if(isSubsequence(v)) cnt_1++,ans[i] = 1; else cnt_0++,ans[i] = 0; continue; } } return ans; }

Compilation message (stderr)

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:48:23: warning: 'bir' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (cnt_0 + 1 + bir - cnt_1 <= N / 2 + 1) {
             ~~~~~~~~~~^~~~~
hidden.cpp:60:39: warning: 'sif' may be used uninitialized in this function [-Wmaybe-uninitialized]
             for (int i = 1 ; i <= sif - cnt_0 ; i++)
                                   ~~~~^~~~~~~
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...