Submission #1126160

#TimeUsernameProblemLanguageResultExecution timeMemory
1126160qrnHidden Sequence (info1cup18_hidden)C++20
24 / 100
6 ms424 KiB
#include<bits/stdc++.h> #include "grader.h" #define pb push_back #define endl "\n" #define ALL(x) x.begin(), x.end() using namespace std; vector<int> findSequence (int N) { int initN = N, l = 0, r = N + 1, numzero = 0; vector<int> seq; while(l <= r) { int mid = (l + r) / 2; for(int i = 0; i < mid; i++) seq.pb(0); if(isSubsequence(seq)) { numzero = mid; l = mid + 1; } else { r = mid - 1; } seq.clear(); } N -= numzero; vector<int>ans; for(int cnt = 0; cnt <= numzero; cnt++) { int l = 0, r = N + 1, numone = 0; while(l <= r) { int mid = (l + r) / 2; for(int i = 0; i < cnt; i++) seq.pb(0); for(int i = 0; i < mid; i++) seq.pb(1); for(int i = cnt; i < numzero; i++) seq.pb(0); if(isSubsequence(seq)) { numone = mid; l = mid + 1; } else{ r = mid - 1; } seq.clear(); } for(int i = 0; i < numone; i++) { ans.pb(1); } ans.pb(0); N -= numone; } seq.clear(); if((int)ans.size() != initN) { ans.pop_back(); } 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...