Submission #486155

#TimeUsernameProblemLanguageResultExecution timeMemory
486155leakedHidden Sequence (info1cup18_hidden)C++14
34 / 100
11 ms328 KiB
#include<bits/stdc++.h> #include "grader.h" using namespace std; #define sz(x) (int)x.size() #define pb push_back #define vec vector vector < int > findSequence (int N) { vector<int>ans; ans.pb(1); int u=0; // cout<<isSubsequence(ans)<<endl; while(sz(ans)<=N && isSubsequence(ans)) u++,ans.pb(1); ans.pop_back(); // for(auto &z : ans) cout<<z<<' '; // cout<<endl; int to=0; if(sz(ans)>(N-sz(ans))){ int h=N-sz(ans); ans.clear(); while(h--) ans.pb(0); to=1; } for(int i=0;i<sz(ans);i++){ if(ans[i]==to) continue; vec<int> nans=ans; while(sz(nans)<N){ // cout<<"DEBUG"<<endl; // for(auto &z : nans) cout<<z<<' '; // cout<<endl; nans.insert(nans.begin()+i,to); if(!isSubsequence(nans)){ nans.erase(nans.begin()+i,nans.begin()+i+1); break; } } ans=nans; } while(sz(ans)!=N) ans.pb(to); 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...