Submission #1143047

#TimeUsernameProblemLanguageResultExecution timeMemory
1143047stdfloatHidden Sequence (info1cup18_hidden)C++20
100 / 100
2 ms416 KiB
#include<bits/stdc++.h> #include "grader.h" // #include "grader.cpp" using namespace std; #define sz(v) (int)(v).size() vector<int> findSequence(int n) { int X = ((n + 1) >> 1); vector<int> ans = {0}; while (sz(ans) <= X && isSubsequence(ans)) ans.push_back(0); ans.pop_back(); int x, y; if (sz(ans) < X) { x = sz(ans); y = n - x; } else { ans = {1}; while (sz(ans) <= X && isSubsequence(ans)) ans.push_back(1); ans.pop_back(); y = sz(ans); x = n - y; } ans.assign(n, 0); int x1 = 0, y1 = 0; for (int i = 0; i < n; i++) { if (x1 + 1 + y - y1 <= X) { vector<int> v(x1 + 1 + y - y1); fill(v.begin() + x1 + 1, v.end(), 1); if (isSubsequence(v)) x1++; else { y1++; ans[i] = 1; } } else { vector<int> v(y1 + 1 + x - x1); fill(v.begin(), v.begin() + y1 + 1, 1); if (isSubsequence(v)) { y1++; ans[i] = 1; } else x1++; } } 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
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...