Submission #69578

#TimeUsernameProblemLanguageResultExecution timeMemory
69578Mamnoon_SiamHidden Sequence (info1cup18_hidden)C++17
34 / 100
13 ms580 KiB
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector<int> make(int ones, vector<int> zs) { vector<int> ret; for(int i = 0; i < zs[0]; i++) ret.emplace_back(0); for(int i = 1; i < zs.size(); i++) { ret.emplace_back(1); for(int j = 0; j < zs[i]; j++) ret.emplace_back(0); } return ret; } int ask(int N, vector<int> vec) { if(vec.size() > N) return 0; return isSubsequence(vec); } vector <int> findSequence (int N) { int ones = 3; for(int i = 1; i <= N; i++) { if(ask(N, make(i, vector<int>(i + 1, 0)))) { ones = i; } else break; } vector<int> zs(ones + 1, 0); for(int it = 0; it < zs.size(); it++) { for(zs[it] = 1; ask(N, make(ones, zs)); zs[it]++) {} zs[it]--; } return make(ones, zs); }

Compilation message (stderr)

hidden.cpp: In function 'std::vector<int> make(int, std::vector<int>)':
hidden.cpp:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < zs.size(); i++) {
                 ~~^~~~~~~~~~~
hidden.cpp: In function 'int ask(int, std::vector<int>)':
hidden.cpp:17:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(vec.size() > N) return 0;
     ~~~~~~~~~~~^~~
hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:29:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int it = 0; it < zs.size(); it++) {
                  ~~~^~~~~~~~~~~
grader.cpp: In function 'int main()':
grader.cpp:28:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fifo_out, "%d\n", ans.size ());
                                ~~~~~~~~~~~^
grader.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<ans.size () && i < N; i++)
                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...