# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
923623 | 2024-02-07T13:42:04 Z | shenfe1 | Hidden Sequence (info1cup18_hidden) | C++17 | 5 ms | 696 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; if(c1<=0){ for(int i=1;i<=n;i++)ans.pb(0); return ans; } if(c0<=0){ for(int i=1;i<=n;i++)ans.pb(1); return ans; } int cnt0=0,cnt1=0; for(int i=1;i<=n;i++){ if(!c1){ ans.pb(0); c0--; continue; } if(!c0){ ans.pb(1); c1--; continue; } vector<int> v; if(cnt0+c1<=cnt1+c0){ for(int i=1;i<=cnt0;i++)v.pb(0); v.pb(0); for(int i=1;i<=c1;i++)v.pb(1); if(isSubsequence(v)){ ans.pb(0); cnt0++; c0--; } else{ ans.pb(1); cnt1++; c1--; } } else{ for(int i=1;i<=cnt1;i++)v.pb(1); v.pb(1); for(int i=1;i<=c0;i++)v.pb(0); if(!isSubsequence(v)){ ans.pb(0); cnt0++; c0--; } else{ ans.pb(1); cnt1++; c1--; } } } assert(c0+c1==0); return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 1 ms | 344 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 1 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 692 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 5 ms | 688 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 4 ms | 428 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 3 ms | 432 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 3 ms | 440 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 3 ms | 696 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 4 ms | 440 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 3 ms | 436 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 4 ms | 692 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 4 ms | 436 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 4 ms | 432 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 3 ms | 436 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 5 ms | 432 KB | Output is correct: Maximum length of a query = 101 |