Submission #923291

#TimeUsernameProblemLanguageResultExecution timeMemory
923291vjudge1Hidden Sequence (info1cup18_hidden)C++17
20 / 100
3059 ms2392 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int>findSequence(int n){ map<set<string>,string>cnt; for(int i=0;i<(1<<n);i++){ string s=""; for(int j=0;j<n;j++){ if((i>>j)&1){ s+='1'; }else{ s+='0'; } } set<string>e; for(int r=(n/2+1);r<=(n/2+1);r++){ for(int k=0;k<(1<<(r));k++){ string t=""; for(int j=0;j<(r);j++){ if((k>>j)&1){ t+='1'; }else{ t+='0'; } } int p=0; for(auto u:s){ if(p<t.size() and u==t[p]){ p++; } } if(p==t.size()){ e.insert(t); } } } cnt[e]=s; } set<string>e; for(int r=(n/2+1);r<=(n/2+1);r++){ for(int k=0;k<(1<<(r));k++){ vector<int>t; string y=""; for(int j=0;j<(r);j++){ if((k>>j)&1){ t.push_back(1); y+='1'; }else{ t.push_back(0); y+='0'; } } if(isSubsequence(t)){ e.insert(y); } } } vector<int>ans; for(auto u:cnt[e]){ ans.push_back(u-'0'); } return ans; }

Compilation message (stderr)

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:28:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |                     if(p<t.size() and u==t[p]){
      |                        ~^~~~~~~~~
hidden.cpp:32:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 if(p==t.size()){
      |                    ~^~~~~~~~~~
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...