Submission #408741

#TimeUsernameProblemLanguageResultExecution timeMemory
408741Atill83Hidden Sequence (info1cup18_hidden)C++14
100 / 100
146 ms296 KiB
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector<int> findSequence(int n){ vector<int> sorg((n + 1) / 2, 0); int less = 0; if(isSubsequence(sorg)){ less = 1; } int idx = 0; while(idx <= (n + 1) / 2 && isSubsequence(vector<int>(idx, less))) idx++; idx--; vector<int> say(2, 0); say[less] = idx; say[!less] = n - idx; vector<int> onc(idx + 1, 0); for(int i = 1; i <= say[less]; i++){ vector<int> srg; for(int j = 0; j < i; j++) srg.push_back(less); bool done = 0; int mx = 0; for(int j = 1; (j + i) <= n / 2 + 1; j++){ srg.push_back(!less); if(!isSubsequence(srg)){ done = 1; mx = j - 1; break; } } if(done){ onc[i] = say[!less] - mx; }else{ mx = 0; for(int j = 0; (j + say[less] - i + 1) <= n / 2 + 1; j++){ mx = j; srg.clear(); for(int l = 0; l < j; l++) srg.push_back(!less); for(int l = 0; l < say[less] - i + 1; l++) srg.push_back(less); if(!isSubsequence(srg)){ done = 1; mx = j - 1; break; } } onc[i] = mx; } } vector<int> ans; int ot = 0; for(int i = 1; i <= idx; i++){ while(ot < onc[i]){ ans.push_back(!less); ot++; } ans.push_back(less); } while(ot < say[!less]){ ot++; ans.push_back(!less); } return ans; }

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...