| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1320739 | c4l | Hidden Sequence (info1cup18_hidden) | C++20 | 1041 ms | 332 KiB |
#include <bits/stdc++.h>
using namespace std;
//#define ngu
#ifndef ngu
#include "grader.h"
#endif
#ifdef ngu
static int maxQ = 0;
static vector < int > theRealAnswer;
bool isSubsequence (vector < int > v)
{
if (v.size () > maxQ)
maxQ = v.size ();
int i = 0;
for (auto it : v)
{
while (i < theRealAnswer.size () && it != theRealAnswer[i]) i ++;
if (i == theRealAnswer.size ()) return 0;
i ++;
}
return 1;
}
#endif
vector<int> findSequence(int n)
{
int maxn = (1<<n);
for (int i = 0;i<maxn;++i){
vector<int> luu;
for (int j = 0;j<n;++j){
if(i & (1<<j))luu.push_back(1);
else luu.push_back(0);
}
if(isSubsequence(luu)){
return luu;
}
}
}
#ifdef ngu
int main ()
{
int n, x;
scanf ("%d", &n), maxQ = 0;
for (int i=1; i<=n; i++)
scanf ("%d", &x), theRealAnswer.push_back (x);
vector < int > ans = findSequence (n);
if (ans.size () != theRealAnswer.size ())
{
printf ("Different lengths\n");
for (auto it : ans)
printf ("%d ", it);
printf ("\n");
return 0;
}
for (int i=0; i<ans.size (); i++)
if (ans[i] != theRealAnswer[i])
{
printf ("WA position %d\n", i + 1);
for (auto it : ans)
printf ("%d ", it);
printf ("\n");
return 0;
}
printf ("Ok, biggest queried length %d\n", maxQ);
return 0;
}
#endif
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
