Submission #486155

# Submission time Handle Problem Language Result Execution time Memory
486155 2021-11-10T16:08:21 Z leaked Hidden Sequence (info1cup18_hidden) C++14
34 / 100
11 ms 328 KB
#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

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 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 8
2 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 9
3 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 8
4 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 6
5 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 7
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 320 KB Output is partially correct: Maximum length of a query = 165
2 Partially correct 7 ms 292 KB Output is partially correct: Maximum length of a query = 178
3 Partially correct 6 ms 328 KB Output is partially correct: Maximum length of a query = 190
4 Partially correct 6 ms 200 KB Output is partially correct: Maximum length of a query = 153
5 Partially correct 10 ms 288 KB Output is partially correct: Maximum length of a query = 187
6 Partially correct 6 ms 296 KB Output is partially correct: Maximum length of a query = 160
7 Partially correct 10 ms 200 KB Output is partially correct: Maximum length of a query = 192
8 Partially correct 6 ms 200 KB Output is partially correct: Maximum length of a query = 163
9 Partially correct 11 ms 300 KB Output is partially correct: Maximum length of a query = 199
10 Partially correct 6 ms 328 KB Output is partially correct: Maximum length of a query = 199
11 Partially correct 8 ms 316 KB Output is partially correct: Maximum length of a query = 190
12 Partially correct 5 ms 200 KB Output is partially correct: Maximum length of a query = 199
13 Partially correct 9 ms 324 KB Output is partially correct: Maximum length of a query = 200