Submission #1126156

#TimeUsernameProblemLanguageResultExecution timeMemory
1126156Captain_GeorgiaHidden Sequence (info1cup18_hidden)C++20
39 / 100
7 ms420 KiB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

vector<int> findSequence (int N) {
    int low = 0, high = N + 1;
    vector<int> tmp;
    while (low < high) {
        int mid = (low + high + 1) / 2;

        tmp.clear();
        for (int i = 0;i < mid;i ++) tmp.push_back(0);

        if (isSubsequence (tmp) == true) {
            low = mid;
        } else {
            high = mid - 1;
        }
    }

    vector<int> answer;
    int cnt_zero = low;
    N -= low;
    for (int i = 0;i < cnt_zero;i ++) {
        low = 0;
        high = N + 1;
        while (low < high) {
            int mid = (low + high + 1) / 2;

            tmp.clear();
            for (int j = 0;j < i;j ++) {
                tmp.push_back(0);
            }
            for (int j = 0;j < mid;j ++) {
                tmp.push_back(1);
            }
            for (int j = i;j < cnt_zero;j ++) {
                tmp.push_back(0);
            }

            if (isSubsequence (tmp) == true) {
                low = mid;
            } else {
                high = mid - 1;
            }
        }
        for (int j = 0;j < low;j ++) {
            answer.push_back(1);
        }
        answer.push_back(0);
        N -= low;
    }
    for (int i = 0;i < N;i ++) answer.push_back(1);
    return answer;
}

Compilation message (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...