Submission #105153

# Submission time Handle Problem Language Result Execution time Memory
105153 2019-04-10T17:55:23 Z stefdasca Hidden Sequence (info1cup18_hidden) C++14
54 / 100
11 ms 384 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int>findSequence(int N)
{
    vector<int> ans (N, 0);
    vector<int> qu;
    vector<int> qu1;
    int nr0 = 0, nr1 = 0;
    while(1)
    {
        qu.push_back(0);
        qu1.push_back(1);
        if(isSubsequence(qu))
            ++nr0;
        else
        {
            nr1 = N - nr0;
            break;
        }
        if(isSubsequence(qu1))
            ++nr1;
        else
        {
            nr0 = N - nr1;
            break;
        }
    }
    int cntsf0 = 0, cntsf1 = 0;
    int str = 0;
    for(int i = 0; i < N; ++i)
    {
        qu.clear();
        if(cntsf0 - str * (i > 0 && ans[i-1] == 0))
            for(int j = 0; j < cntsf0 - str * (i > 0 && ans[i-1] == 0); ++j)
                qu.push_back(0);
        else
            for(int j = 0; j < cntsf1 - str * (i > 0 && ans[i-1] == 1); ++j)
                qu.push_back(1);
        for(int j = 0; j < str; ++j)
            qu.push_back(ans[i-1]);
        if(nr0 <= nr1)
        {
            qu.push_back(1);
            for(int j = 0; j < nr0; ++j)
                qu.push_back(0);
            if(isSubsequence(qu))
                ans[i] = 1, ++cntsf1, --nr1;
            else
                ans[i] = 0, ++cntsf0, --nr0;
        }
        else
        {
            qu.push_back(0);
            for(int j = 0; j < nr1; ++j)
                qu.push_back(1);
            if(isSubsequence(qu))
                ans[i] = 0, ++cntsf0, --nr0;
            else
                ans[i] = 1, ++cntsf1, --nr1;
        }
        if(i == 0)
            str = 1;
        else
            if(ans[i] == ans[i-1])
                ++str;
            else
                str = 1;
    }
    return ans;
}

Compilation message

grader.cpp: In function 'int main()':
grader.cpp:28:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fifo_out, "%d\n", ans.size ());
                                ~~~~~~~~~~~^
grader.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<ans.size () && i < N; i++)
                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 256 KB Output is partially correct: Maximum length of a query = 6
2 Partially correct 2 ms 384 KB Output is partially correct: Maximum length of a query = 7
3 Partially correct 3 ms 256 KB Output is partially correct: Maximum length of a query = 6
4 Partially correct 2 ms 256 KB Output is partially correct: Maximum length of a query = 9
5 Partially correct 2 ms 256 KB Output is partially correct: Maximum length of a query = 6
# Verdict Execution time Memory Grader output
1 Partially correct 9 ms 256 KB Output is partially correct: Maximum length of a query = 92
2 Partially correct 6 ms 320 KB Output is partially correct: Maximum length of a query = 103
3 Partially correct 8 ms 384 KB Output is partially correct: Maximum length of a query = 102
4 Partially correct 6 ms 256 KB Output is partially correct: Maximum length of a query = 85
5 Partially correct 10 ms 384 KB Output is partially correct: Maximum length of a query = 103
6 Partially correct 9 ms 256 KB Output is partially correct: Maximum length of a query = 130
7 Partially correct 6 ms 328 KB Output is partially correct: Maximum length of a query = 135
8 Partially correct 7 ms 384 KB Output is partially correct: Maximum length of a query = 96
9 Partially correct 8 ms 384 KB Output is partially correct: Maximum length of a query = 121
10 Partially correct 8 ms 384 KB Output is partially correct: Maximum length of a query = 103
11 Partially correct 8 ms 256 KB Output is partially correct: Maximum length of a query = 97
12 Partially correct 9 ms 324 KB Output is partially correct: Maximum length of a query = 150
13 Partially correct 11 ms 256 KB Output is partially correct: Maximum length of a query = 105