Submission #963368

#TimeUsernameProblemLanguageResultExecution timeMemory
963368biankHidden Sequence (info1cup18_hidden)C++14
100 / 100
5 ms1460 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define sz(x) int(x.size()) int query(int k, int a, int b) { vector<int> s(a, k); while (b--) s.push_back(k ^ 1); return k ^ 1 ^ isSubsequence(s); } vector<int> findSequence(int N) { vector<int> s0, s1; int n = 0, k = -1; 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) { int x = -1; if (i + m - j < j + n - i) { x = query(k, i + 1, m - j); } else { x = query(k ^ 1, j + 1, n - i); } if (x == k) i++; else j++; ans.push_back(x); } while (i < n) ans.push_back(k), i++; while (j < m) ans.push_back(k ^ 1), j++; 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...