Submission #381807

#TimeUsernameProblemLanguageResultExecution timeMemory
381807zoooma13Hidden Sequence (info1cup18_hidden)C++14
0 / 100
3071 ms1252 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector <int> findSequence(int N){ int C = isSubsequence(vector<int>(N/2+1 ,0)) ,cnt = 1; while(isSubsequence(vector<int>(cnt ,C))) cnt++; if(--cnt == 0) return vector <int>(N ,!C); vector <int> pos; for(int i=cnt; i>=0; i--){ vector <int> q(cnt ,C); q.insert(q.begin()+i ,!C); if(isSubsequence(q)) pos.push_back(i); } if(pos.size() == 1){ vector <int> invC(N-cnt ,!C) ,q(cnt ,C); q.insert(q.begin()+pos.front() ,invC.begin() ,invC.end()); return q; } int rem = N - cnt; vector <int> dis(pos.size() ,-1); for(int i=0; i<pos.size(); i++){ vector <int> q(cnt ,C); for(int l = 1; l <= N/4 + 1; l++){ q.insert(q.begin()+pos[i] ,!C); if(!isSubsequence(q)){ dis[i] = l-1; rem -= l-1; break; } } } if(rem) *find(dis.begin() ,dis.end() ,-1) = rem; vector <int> ans(cnt ,C); for(int i=0; i<pos.size(); i++) while(dis[i]--) ans.insert(ans.begin()+pos[i] ,!C); return ans; }

Compilation message (stderr)

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=0; i<pos.size(); i++){
      |                  ~^~~~~~~~~~~
hidden.cpp:43:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int i=0; i<pos.size(); i++)
      |                  ~^~~~~~~~~~~
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...