# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
434409 | 2021-06-21T08:43:43 Z | Dymo | Hidden Sequence (info1cup18_hidden) | C++17 | 4 ms | 200 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define endl "\n" const ll maxn=2e5+10; const ll mod =998244353 ; const ll base=1e13; #include "grader.h" bool chk(ll dem,ll pre,ll i,ll nxt1,ll pre1,ll n) { ll pre0=pre+dem; ll nxt0=n-pre0-nxt1-pre1-1; vector<int> vt; if (pre0+nxt1+1<=(n)/2+1) { while (pre0--) vt.pb(0); vt.pb(1); while (nxt1--) vt.pb(1); } else { while (pre1--) vt.pb(1); vt.pb(1); while (nxt0--) vt.pb(0); } return isSubsequence(vt); } vector < int > findSequence (int N) { ll n=N; ll t=(n)/2+1; ll cnt0; ll cnt1; for (int j=1; j<=t; j++) { vector<int > vt(j,0); if (!isSubsequence(vt)) { cnt0=j-1; cnt1=n-cnt0; break; } vt=vector<int> (j,1); if (!isSubsequence(vt)) { cnt1=j-1; cnt0=n-cnt0; break; } } ll pre=0; vector<int> ans; for (int j=1;j<=cnt1;j++) { ll pre1=j-1; ll nxt1=cnt1-j; ll dem=1; while (dem+pre+cnt1<=n&&chk(dem,pre,j,nxt1,pre1,n)) { dem++; } dem--; pre+=dem; while (dem--) ans.pb(0); ans.pb(1); } ll cl=n-cnt1-pre; while (cl--) ans.pb(0); return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Output is not correct: The returned sequence does not match the hidden one |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 200 KB | Output is not correct: The returned sequence does not match the hidden one |
2 | Halted | 0 ms | 0 KB | - |