Submission #923291

# Submission time Handle Problem Language Result Execution time Memory
923291 2024-02-07T05:13:25 Z vjudge1 Hidden Sequence (info1cup18_hidden) C++17
20 / 100
400 ms 2392 KB
#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

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 time Memory Grader output
1 Correct 2 ms 700 KB Output is correct: Maximum length of a query = 5
2 Correct 13 ms 2392 KB Output is correct: Maximum length of a query = 6
3 Correct 2 ms 704 KB Output is correct: Maximum length of a query = 5
4 Correct 4 ms 1112 KB Output is correct: Maximum length of a query = 5
5 Correct 1 ms 344 KB Output is correct: Maximum length of a query = 4
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 660 KB Time limit exceeded
2 Halted 0 ms 0 KB -