Submission #923391

# Submission time Handle Problem Language Result Execution time Memory
923391 2024-02-07T07:15:45 Z vjudge1 Hidden Sequence (info1cup18_hidden) C++17
34 / 100
5 ms 960 KB
#include <bits/stdc++.h>
#include "grader.h"

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

using namespace std;

#define pb push_back


vector<int> findSequence(int n){
  int L=(n/2)+1;
  int c1=-1,c0=-1;
  for(int i=1;i<=L;i++){
    vector<int> v;
    for(int j=1;j<=i;j++)v.pb(1);
    if(!isSubsequence(v)){
      c1=i-1;
      c0=n-c1;
      break;
    }
  }
  for(int i=1;i<=L;i++){
    vector<int> v;
    for(int j=1;j<=i;j++)v.pb(0);
    if(!isSubsequence(v)){
      c0=i-1;
      c1=n-c0;
      break;
    }
  }
  vector<int> ans;
  int cnt0=0,cnt1=0;
  for(int i=1;i<=n;i++){
    vector<int> v=ans;
    if(c1){
      v.pb(1);
      for(int j=1;j<=c0;j++)v.pb(0);
      if(isSubsequence(v)){
        ans.pb(1);
        cnt1++;
        c1--;
      }
      else{
        ans.pb(0);
        cnt0++;
        c0--;
      }
    }
    else{
      c0--;
      ans.pb(0);
    }
  }
  assert(c0+c1==0);
  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 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 344 KB Output is partially correct: Maximum length of a query = 8
4 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 9
5 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 7
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 464 KB Output is partially correct: Maximum length of a query = 165
2 Partially correct 4 ms 440 KB Output is partially correct: Maximum length of a query = 178
3 Partially correct 5 ms 940 KB Output is partially correct: Maximum length of a query = 190
4 Partially correct 3 ms 440 KB Output is partially correct: Maximum length of a query = 153
5 Partially correct 4 ms 468 KB Output is partially correct: Maximum length of a query = 188
6 Partially correct 3 ms 432 KB Output is partially correct: Maximum length of a query = 172
7 Partially correct 4 ms 692 KB Output is partially correct: Maximum length of a query = 192
8 Partially correct 4 ms 692 KB Output is partially correct: Maximum length of a query = 164
9 Partially correct 4 ms 948 KB Output is partially correct: Maximum length of a query = 200
10 Partially correct 5 ms 960 KB Output is partially correct: Maximum length of a query = 199
11 Partially correct 4 ms 692 KB Output is partially correct: Maximum length of a query = 190
12 Partially correct 4 ms 948 KB Output is partially correct: Maximum length of a query = 199
13 Partially correct 5 ms 960 KB Output is partially correct: Maximum length of a query = 200