Submission #963362

#TimeUsernameProblemLanguageResultExecution timeMemory
963362biankHidden Sequence (info1cup18_hidden)C++14
34 / 100
5 ms1208 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define sz(x) int(x.size()) bool query(int k, vector<int> s, int c) { s.push_back(k ^ 1); while (c--) s.push_back(k); return isSubsequence(s); } vector<int> findSequence(int N) { int l = 0, r = N + 1; vector<int> s; while (l + 1 < r) { int m = (l + r) / 2; while (sz(s) > m) s.pop_back(); while (sz(s) < m) s.push_back(0); if (isSubsequence(s)) { l = m; } else { r = m; } } int n = l, m = N - l; int k = 0; if (n > m) swap(n, m), k ^= 1; vector<int> ans; int i = 0, j = 0; while (i < n || j < m) { if (i >= n || (j < m && query(k, ans, n - i))) { ans.push_back(k ^ 1); j++; } else { ans.push_back(k); i++; } } 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...