답안 #105146

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
105146 2019-04-10T17:33:23 Z stefdasca Hidden Sequence (info1cup18_hidden) C++14
0 / 100
5 ms 304 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int>findSequence(int N)
{
    vector<int> ans;
    vector<int> qu;
    vector<int> qu1;
    int stp = 0, nr0 = 0, nr1 = 0;
    while(1)
    {
        qu.push_back(0);
        qu1.push_back(1);
        if(!isSubsequence(qu))
        {
            nr1 = N - stp;
            nr0 = stp;
            break;
        }
        if(isSubsequence(qu1))
        {
            nr1 = stp;
            nr0 = N - stp;
            break;
        }
        ++stp;
    }
    int cntsf0 = 0, cntsf1 = 0;
    for(int i = 0; i < N; ++i)
    {
        qu.clear();
        if(nr0 <= nr1)
        {
            for(int j = 0; j < cntsf0; ++j)
                qu.push_back(0);
            qu.push_back(1);
            for(int j = cntsf0; j < nr0; ++j)
                qu.push_back(0);
            if(isSubsequence(qu))
                ans.push_back(1);
            else
                ans.push_back(0), ++cntsf0;
        }
        else
        {
            for(int j = 0; j < cntsf1; ++j)
                qu.push_back(1);
            qu.push_back(0);
            for(int j = cntsf1; j < nr1; ++j)
                qu.push_back(1);
            if(isSubsequence(qu))
                ans.push_back(0);
            else
                ans.push_back(1), ++cntsf1;
        }
    }
    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++)
                   ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output is not correct: The returned sequence does not match the hidden one
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 304 KB Output is not correct: The returned sequence does not match the hidden one
2 Halted 0 ms 0 KB -