답안 #963360

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963360 2024-04-14T21:37:41 Z biank Hidden Sequence (info1cup18_hidden) C++14
34 / 100
4 ms 948 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

#define sz(x) int(x.size())

bool query(vector<int> s, int c) {
    s.push_back(1);
    while (c--) s.push_back(0);
    return isSubsequence(s);
}

vector<int> findSequence(int N) {
    int l = 0, r = N + 1;
    vector<int> s;
    while (l + 1 < r) {
        int m = (l + r) / 2;
        while (sz(s) > m) s.pop_back();
        while (sz(s) < m) s.push_back(0);
        if (isSubsequence(s)) {
            l = m;
        } else {
            r = m;
        }
    }
    int n = l, m = N - l;
    vector<int> ans;
    int i = 0, j = 0;
    while (i < n || j < m) {
        if (i >= n || (j < m && query(ans, n - i))) {
            ans.push_back(1);
            j++;
        } else {
            ans.push_back(0);
            i++;
        }
    }
    return ans;
}

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 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 8
2 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 10
3 Partially correct 0 ms 596 KB Output is partially correct: Maximum length of a query = 8
4 Correct 0 ms 344 KB Output is correct: Maximum length of a query = 5
5 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 7
# 결과 실행 시간 메모리 Grader output
1 Partially correct 3 ms 436 KB Output is partially correct: Maximum length of a query = 165
2 Partially correct 3 ms 688 KB Output is partially correct: Maximum length of a query = 178
3 Partially correct 3 ms 704 KB Output is partially correct: Maximum length of a query = 188
4 Partially correct 2 ms 692 KB Output is partially correct: Maximum length of a query = 151
5 Partially correct 4 ms 948 KB Output is partially correct: Maximum length of a query = 188
6 Partially correct 2 ms 436 KB Output is partially correct: Maximum length of a query = 172
7 Partially correct 3 ms 692 KB Output is partially correct: Maximum length of a query = 192
8 Partially correct 3 ms 436 KB Output is partially correct: Maximum length of a query = 164
9 Partially correct 3 ms 436 KB Output is partially correct: Maximum length of a query = 200
10 Partially correct 3 ms 948 KB Output is partially correct: Maximum length of a query = 199
11 Partially correct 3 ms 692 KB Output is partially correct: Maximum length of a query = 190
12 Partially correct 3 ms 696 KB Output is partially correct: Maximum length of a query = 199
13 Partially correct 4 ms 700 KB Output is partially correct: Maximum length of a query = 200