제출 #1183018

#제출 시각아이디문제언어결과실행 시간메모리
118301812345678Hidden Sequence (info1cup18_hidden)C++17
100 / 100
2 ms420 KiB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

const int nx=205;

int t0, t1, c0, c1, f;

vector<int> findSequence (int N)
{
    int mx=(N+2)/2;
    vector<int> tmp, res;
    res.resize(N);
    for (int i=1; i<=mx; i++) 
    {
        tmp.push_back(0);
        if (!isSubsequence(tmp))
        {
            t0=i-1;
            t1=N-t0;
            f=1;
            break;
        }
    }
    tmp.clear();
    for (int i=1; i<=mx; i++)
    {
        tmp.push_back(1);
        if (!isSubsequence(tmp))
        {
            t1=i-1;
            t0=N-t1;
            f=1;
            break;
        }
    }
    //cout<<"debug "<<t0<<' '<<t1<<'\n';
    for (int i=0; i<N;i ++)
    {
        //cout<<"c "<<c0<<' '<<c1<<'\n';
        if (c0+1+t1-c1<=mx)
        {
            tmp.resize(c0+1+t1-c1, 0);
            for (auto &x:tmp) x=0;
            for (int j=c0+1; j<tmp.size(); j++) tmp[j]=1;
            //cout<<"query ";
            //for (auto x:tmp) cout<<x<<' ';
            //cout<<'\n';
            if (isSubsequence(tmp)) c0++;
            else c1++, res[i]=1;
        }
        else
        {
            tmp.resize(c1+1+t0-c0, 0);
            for (auto &x:tmp) x=0;
            for (int j=0; j<c1+1; j++) tmp[j]=1;
            if (isSubsequence(tmp)) c1++, res[i]=1;
            else c0++;
        }
    }
    return res;
}

컴파일 시 표준 에러 (stderr) 메시지

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
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...