답안 #244872

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244872 2020-07-05T07:58:50 Z uacoder123 사육제 (CEOI14_carnival) C++14
100 / 100
17 ms 420 KB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
 
typedef int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
vi v;
int qu(int s,int e,int ex)
{
  cout<<e-s+2<<' ';
  for(int i=s;i<=e;++i)
  {
    cout<<v[i]<<' ';
  }
  cout<<ex<<endl;
  int ans;
  cin>>ans;
  return(ans);
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lli test=1;
  for(;test>0;--test)
  {
    int n,x=1,c=1;
    cin>>n;
    vi arr(n+1);
    arr[1]=x;
    x++;
    v.pb(1);
    for(int i=2;i<=n;++i)
    {
      int g=qu(0,v.size()-1,i);
      if(c==g-1)
      {
        v.pb(i);
        arr[i]=x;
        x++;
        c++;
      }
      else
      {
        int l=0,r=v.size()-1,ans=-1;
        while(l<=r)
        {
          int m=(l+r)/2;
          if(qu(l,m,i)==(m-l+1))
          {
            ans=m;
            r=m-1;
          }
          else
            l=m+1;
        }
        arr[i]=arr[v[ans]];
      }
    }
    cout<<0<<' ';
    for(int i=1;i<=n;++i)
      cout<<arr[i]<<' ';
    cout<<endl;
  }
  return(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 17 ms 384 KB Output is correct
3 Correct 10 ms 384 KB Output is correct
4 Correct 7 ms 420 KB Output is correct
5 Correct 10 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 10 ms 384 KB Output is correct
6 Correct 10 ms 384 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 9 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 12 ms 308 KB Output is correct
3 Correct 10 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 12 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 11 ms 384 KB Output is correct
6 Correct 9 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct