답안 #493760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
493760 2021-12-12T20:05:32 Z Habitus Hidden Sequence (info1cup18_hidden) C++14
0 / 100
84 ms 328 KB
#include "grader.h"
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dec(x, y) fixed << setprecision((y)) << (x)
#define xx first
#define yy second
#define srt(v) sort((v).begin(), (v).end())
#define srtr(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define popb pop_back
#define sz(a) (int)(a).size()
#define len(a) (int)(a).length()
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool nasao, nasao1;
int d, je, gde[200];
vector<int> findSequence(int N) {
    d=N/2+1;
    vector<int> v;
    for(int i=1; i<=d; i++) {
        v.pb(1);
        bool da=isSubsequence(v);
        if(!da) {
            je=i-1;
            nasao=1;
            break;
        }
    }
    if(!nasao) {
        v.clear();
        for(int i=1; i<=d; i++) {
            v.pb(0);
            bool da=isSubsequence(v);
            if(!da) {
                je=N-i+1;
                break;
            }
        }
    }
    for(int a=0; a<je; a++) {
        nasao=nasao1=0;
        for(int i=0; i+je-a<=d; i++) {
            v.clear();
            for(int j=0; j<i; j++) v.pb(0);
            for(int j=0; j<je-a; j++) v.pb(1);
            bool da=isSubsequence(v);
            if(!da) {
                gde[a]=i+a-1;
                nasao=1;
                break;
            }
        }
        if(!nasao) {
            v.clear();
            for(int j=0; j<a; j++) v.pb(1);
            for(int i=0; i+a+1<=d; i++) {
                if(i==0) v.pb(1);
                else v.pb(0);
                bool da=isSubsequence(v);
                if(!da) {
                    gde[a]=N-2-je-i+a;
                    nasao1=1;
                    break;
                }
            }
        }
        if(!nasao1) {
            gde[a]=d-je+2*a;
        }
    }
    v.resize(N);
    for(int i=0; i<je; i++) {
        v[gde[i]]=1;
    }
    return v;
}

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++)
      |                   ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 84 ms 200 KB Output is not correct: The returned sequence does not match the hidden one
2 Halted 0 ms 0 KB -