# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
67301 | 2018-08-13T20:19:50 Z | hamzqq9 | Hidden Sequence (info1cup18_hidden) | C++14 | 11 ms | 564 KB |
#include<bits/stdc++.h> #include "grader.h" #define st first #define nd second #define pb push_back #define ppb pop_back #define umax(x,y) x=max(x,y) #define umin(x,y) x=min(x,y) #define ll long long #define ii pair<int,int> #define iii pair<int,ii> #define sz(x) ((int) x.size()) #define orta ((bas+son)>>1) #define all(x) x.begin(),x.end() #define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" " #define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar() #define pw(x) (1<<(x)) #define inf 2000000000 #define MOD 1000000007 #define MAX 10000006 #define LOG 22 using namespace std; int MXQ; bool query(vector<int> res) { return isSubsequence(res); } int f1(int N) { for(int i=1;i<=N;i++) { vector<int> que; if(i>MXQ) { for(int j=0;j<N-i;j++) que.pb(0); bool res=query(que); if(res==true) return i-1; } else { for(int j=0;j<i;j++) que.pb(1); bool res=query(que); if(res==false) return i-1; } } return N; } vector < int > findSequence (int N) { MXQ=N/2+1; int h1=f1(N); int h0=N-h1; int p1=0; int p0=0; vector<int> ans; for(int i=0;i<N;i++) { // is it 1 vector<int> que; if(p1+1+h0<=MXQ) { for(int j=0;j<p1+1;j++) que.pb(1); for(int j=0;j<h0;j++) que.pb(0); bool res=query(que); if(res) { p1++; h1--; ans.pb(1); } else { p0++; h0--; ans.pb(0); } } else { for(int j=0;j<p0+1;j++) que.pb(0); for(int j=0;j<h1;j++) que.pb(1); bool res=query(que); if(res) { p0++; h0--; ans.pb(0); } else { p1++; h1--; ans.pb(1); } } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 2 ms | 436 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 2 ms | 436 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 2 ms | 540 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 2 ms | 540 KB | Output is correct: Maximum length of a query = 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 540 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 6 ms | 540 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 6 ms | 540 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 7 ms | 540 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 7 ms | 540 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 5 ms | 556 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 6 ms | 556 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 4 ms | 564 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 8 ms | 564 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 7 ms | 564 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 11 ms | 564 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 7 ms | 564 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 7 ms | 564 KB | Output is correct: Maximum length of a query = 101 |