Submission #770086

# Submission time Handle Problem Language Result Execution time Memory
770086 2023-06-30T18:21:28 Z Andrei Hidden Sequence (info1cup18_hidden) C++17
34 / 100
7 ms 316 KB
#include <bits/stdc++.h>

#include "grader.h"

using namespace std; 

vector <int> aux;

int cntPref[2];
int cntSuff[2];

vector <int> ans;

vector <int> findSequence(int n)
{
    aux.push_back(1);
    while((int)aux.size()<=n)
    {
        if(isSubsequence(aux)==1)
            cntSuff[1]++;
        aux.push_back(1);
    }

    cntSuff[0]=n-cntSuff[1];

    while((int)ans.size()<n)
    {
        if(cntPref[0]+1+cntSuff[1]<cntPref[1]+1+cntSuff[0])
        {
            aux.clear();
            for(int i=1; i<=cntPref[0]+1; i++)
                aux.push_back(0);
            for(int i=1; i<=cntSuff[1]; i++)
                aux.push_back(1);

            if(isSubsequence(aux)==1)
                ans.push_back(0);
            else
                ans.push_back(1);
        }
        else
        {
            aux.clear();
            for(int i=1; i<=cntPref[1]+1; i++)
                aux.push_back(1);
            for(int i=1; i<=cntSuff[0]; i++)
                aux.push_back(0);

            if(isSubsequence(aux)==1)
                ans.push_back(1);
            else
                ans.push_back(0);
        }

        cntPref[ans.back()]++;
        cntSuff[ans.back()]--;
    }

    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++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 208 KB Output is partially correct: Maximum length of a query = 8
2 Partially correct 0 ms 288 KB Output is partially correct: Maximum length of a query = 10
3 Partially correct 1 ms 208 KB Output is partially correct: Maximum length of a query = 8
4 Partially correct 1 ms 208 KB Output is partially correct: Maximum length of a query = 9
5 Partially correct 1 ms 256 KB Output is partially correct: Maximum length of a query = 7
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 208 KB Output is partially correct: Maximum length of a query = 165
2 Partially correct 7 ms 208 KB Output is partially correct: Maximum length of a query = 178
3 Partially correct 6 ms 308 KB Output is partially correct: Maximum length of a query = 190
4 Partially correct 4 ms 208 KB Output is partially correct: Maximum length of a query = 153
5 Partially correct 5 ms 208 KB Output is partially correct: Maximum length of a query = 188
6 Partially correct 5 ms 304 KB Output is partially correct: Maximum length of a query = 172
7 Partially correct 4 ms 208 KB Output is partially correct: Maximum length of a query = 192
8 Partially correct 4 ms 300 KB Output is partially correct: Maximum length of a query = 164
9 Partially correct 7 ms 300 KB Output is partially correct: Maximum length of a query = 200
10 Partially correct 6 ms 316 KB Output is partially correct: Maximum length of a query = 199
11 Partially correct 6 ms 304 KB Output is partially correct: Maximum length of a query = 190
12 Partially correct 5 ms 208 KB Output is partially correct: Maximum length of a query = 199
13 Partially correct 5 ms 208 KB Output is partially correct: Maximum length of a query = 200