Submission #72685

#TimeUsernameProblemLanguageResultExecution timeMemory
72685memikakizakiHidden Sequence (info1cup18_hidden)C++14
100 / 100
13 ms628 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; vector<int> findSequence(int n) { int cnt_small = 0, small = 0; vector<int> tmp; while(cnt_small <= n / 2) { tmp.push_back(0); if(!isSubsequence(tmp)) break; ++cnt_small; } if(cnt_small == n / 2 + 1) { cnt_small = 0; tmp.clear(); small = 1; while(cnt_small <= n / 2) { tmp.push_back(1); if(!isSubsequence(tmp)) break; ++cnt_small; } } int l_larges = 0, r_larges = n - cnt_small; vector<int> ans; for(int sect = 0; sect <= cnt_small; sect++) { bool valid = true; while(valid && r_larges) { vector<int> query_vec; if(cnt_small - sect + l_larges <= sect + r_larges) { for(int i = 0; i < l_larges + 1; i++) query_vec.push_back(small ^ 1); for(int i = 0; i < cnt_small - sect; i++) query_vec.push_back(small); if(isSubsequence(query_vec)) { ans.push_back(small ^ 1); ++l_larges; --r_larges; } else valid = false; } else { for(int i = 0; i < sect + 1; i++) query_vec.push_back(small); for(int i = 0; i < r_larges; i++) query_vec.push_back(small ^ 1); if(!isSubsequence(query_vec)) { ans.push_back(small ^ 1); ++l_larges; --r_larges; } else valid = false; } } if(sect != cnt_small) ans.push_back(small); } return ans; }

Compilation message (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...