답안 #471941

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
471941 2021-09-11T22:37:35 Z nickmet2004 Hidden Sequence (info1cup18_hidden) C++11
컴파일 오류
0 ms 0 KB
#include<bits/stdc+.h>
#include "grader.h"
using namespace std;
int Q,k;
int ask(int x , int y, int A){
    vector<int> v;
    while(x--) v.emplace_back(A);
    while(y--) v.emplace_back(A^1);
    int w = n0 - x;
    while(w--) v.emplace_back(A);
    return isSubsequence(v);
}
vector<int> find_Sequence(int n){
    vector<int> ans;
    ans.resize(n);
    int n0 = n1 = 0;
    for(int i = 1; i <= n; ++i){
        if(!ask(i,0,0)){
            n0 = i - 1;
            n1 = n - n0;
            break;
        }
    }
    if(n0<n1) {Q^=1; swap(n0 , n1)};
    k=n;
    while(1){
        if(k==1)break;
        int one= 1;
        while(1){
            if(!ask(n0 , one , Q)){
                one--;
                ans[k - one-1] = 1;
                k-= one;
                n0--;
                break;
            }
            one++;
        }
    }
    for(int i = 0; i < n; ++i){
        if(ans[i]) ans[i] = Q;
        else ans[i] = Q^1;
    }
    return ans;
}

Compilation message

hidden.cpp:1:9: fatal error: bits/stdc+.h: No such file or directory
    1 | #include<bits/stdc+.h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
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++)
      |                   ~^~~~~~~~~~~~