Submission #1060324

# Submission time Handle Problem Language Result Execution time Memory
1060324 2024-08-15T12:58:20 Z pera Hidden Sequence (info1cup18_hidden) C++17
87 / 100
5 ms 600 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> findSequence(int N){
   int zero = 0 , one = 0;
   vector<int> ans , X;
   for(int i = 1;i <= N / 2 + 1;i ++){
      X.emplace_back(1);
      if(isSubsequence(X)){
         one = i;
         zero = N - i;
      }
   }
   if(one == N / 2 + 1){
      vector<int>().swap(X);
      for(int i = 1;i <= N / 2 + 1;i ++){
         X.emplace_back(0);
         if(isSubsequence(X)){
            zero = i;
            one = N - i;
         }
      }
   }
   vector<int> o(2);
   auto is_Zero = [&](){
      vector<int> v;
      if(o[0] + (one - o[1]) <= N / 2 + 1){
         for(int x = 1;x <= o[0] + 1;x ++){
            v.emplace_back(0);
         }
         for(int x = 1;x <= one - o[1];x ++){
            v.emplace_back(1);
         }
         return isSubsequence(v);
      }else{
         for(int x = 1;x <= o[1] + 1;x ++){
            v.emplace_back(1);
         }
         for(int x = 1;x <= zero - o[0];x ++){
            v.emplace_back(0);
         }
         return !isSubsequence(v);
      }
   };
   for(int i = 1;i <= N;i ++){
      ans.emplace_back(!is_Zero());
      o[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 0 ms 344 KB Output is partially correct: Maximum length of a query = 6
2 Partially correct 1 ms 344 KB Output is partially correct: Maximum length of a query = 7
3 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 6
4 Partially correct 1 ms 344 KB Output is partially correct: Maximum length of a query = 6
5 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 5
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 344 KB Output is partially correct: Maximum length of a query = 84
2 Partially correct 4 ms 344 KB Output is partially correct: Maximum length of a query = 91
3 Partially correct 4 ms 344 KB Output is partially correct: Maximum length of a query = 97
4 Partially correct 3 ms 440 KB Output is partially correct: Maximum length of a query = 78
5 Partially correct 3 ms 344 KB Output is partially correct: Maximum length of a query = 96
6 Partially correct 2 ms 600 KB Output is partially correct: Maximum length of a query = 88
7 Partially correct 3 ms 344 KB Output is partially correct: Maximum length of a query = 98
8 Partially correct 2 ms 344 KB Output is partially correct: Maximum length of a query = 84
9 Partially correct 3 ms 344 KB Output is partially correct: Maximum length of a query = 102
10 Partially correct 3 ms 344 KB Output is partially correct: Maximum length of a query = 101
11 Partially correct 4 ms 344 KB Output is partially correct: Maximum length of a query = 97
12 Partially correct 5 ms 344 KB Output is partially correct: Maximum length of a query = 101
13 Partially correct 3 ms 344 KB Output is partially correct: Maximum length of a query = 102