Submission #963365

#TimeUsernameProblemLanguageResultExecution timeMemory
963365biankHidden Sequence (info1cup18_hidden)C++14
34 / 100
6 ms1220 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> s0, s1; int n = 0, k = 0; while (true) { s0.push_back(0); if (!isSubsequence(s0)) { k = 0; break; } s1.push_back(1); if (!isSubsequence(s1)) { k = 1; break; } n++; } int m = N - n; 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)

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:15:9: warning: unused variable 'l' [-Wunused-variable]
   15 |     int l = 0, r = N + 1;
      |         ^
hidden.cpp:15:16: warning: unused variable 'r' [-Wunused-variable]
   15 |     int l = 0, r = N + 1;
      |                ^
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...