Submission #381812

#TimeUsernameProblemLanguageResultExecution timeMemory
381812zoooma13Hidden Sequence (info1cup18_hidden)C++14
59 / 100
10 ms492 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); } 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; q.size() <= 3*N/4; 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]-- > 0) ans.insert(ans.begin()+pos[i] ,!C); return ans; }

Compilation message (stderr)

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0; i<pos.size(); i++){
      |                  ~^~~~~~~~~~~
hidden.cpp:24:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |         for(int l = 1; q.size() <= 3*N/4; l++){
      |                        ~~~~~~~~~^~~~~~~~
hidden.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     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...