Submission #400606

# Submission time Handle Problem Language Result Execution time Memory
400606 2021-05-08T11:55:29 Z dolphingarlic Hidden Sequence (info1cup18_hidden) C++14
34 / 100
9 ms 328 KB
#include <bits/stdc++.h>

#include "grader.h"

using namespace std;

vector<int> findSequence(int N) {
    int zeroes = 0;
    for (int i = 1; i <= N; i++) {
        vector<int> tst;
        for (int j = 0; j < i; j++) tst.push_back(0);
        if (isSubsequence(tst)) zeroes++;
        else break;
    }
    vector<int> ans;
    while (zeroes) {
        int ones = 0;
        for (int i = 1; i <= N; i++) {
            vector<int> tst = ans;
            for (int j = 0; j < i; j++) tst.push_back(1);
            for (int j = 0; j < zeroes; j++) tst.push_back(0);
            if (tst.size() > N) break;
            if (isSubsequence(tst)) ones++;
            else break;
        }
        for (int i = 0; i < ones; i++) ans.push_back(1);
        ans.push_back(0);
        zeroes--;
    }
    while (ans.size() < N) ans.push_back(1);
    return ans;
}

Compilation message

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:22:28: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |             if (tst.size() > N) break;
      |                 ~~~~~~~~~~~^~~
hidden.cpp:30:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     while (ans.size() < N) ans.push_back(1);
      |            ~~~~~~~~~~~^~~
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++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 8
2 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 10
3 Partially correct 1 ms 200 KB Output is partially correct: Maximum length of a query = 8
4 Correct 1 ms 200 KB Output is correct: Maximum length of a query = 5
5 Partially correct 1 ms 220 KB Output is partially correct: Maximum length of a query = 7
# Verdict Execution time Memory Grader output
1 Partially correct 6 ms 324 KB Output is partially correct: Maximum length of a query = 165
2 Partially correct 7 ms 304 KB Output is partially correct: Maximum length of a query = 178
3 Partially correct 9 ms 200 KB Output is partially correct: Maximum length of a query = 188
4 Partially correct 5 ms 328 KB Output is partially correct: Maximum length of a query = 151
5 Partially correct 8 ms 200 KB Output is partially correct: Maximum length of a query = 188
6 Partially correct 7 ms 200 KB Output is partially correct: Maximum length of a query = 172
7 Partially correct 7 ms 200 KB Output is partially correct: Maximum length of a query = 192
8 Partially correct 7 ms 200 KB Output is partially correct: Maximum length of a query = 164
9 Partially correct 7 ms 328 KB Output is partially correct: Maximum length of a query = 200
10 Partially correct 8 ms 204 KB Output is partially correct: Maximum length of a query = 199
11 Partially correct 8 ms 300 KB Output is partially correct: Maximum length of a query = 190
12 Partially correct 7 ms 312 KB Output is partially correct: Maximum length of a query = 199
13 Partially correct 8 ms 308 KB Output is partially correct: Maximum length of a query = 200