Submission #244848

# Submission time Handle Problem Language Result Execution time Memory
244848 2020-07-05T07:25:43 Z uacoder123 Carnival (CEOI14_carnival) C++14
0 / 100
11 ms 384 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;
            l=m+1;
          }
          else
            r=m-1;
        }
        arr[i]=arr[v[ans]];
      }
    }
    cout<<0<<' ';
    for(int i=1;i<=n;++i)
      cout<<arr[i]<<' ';
    cout<<endl;
  }
  return(0);
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Integer 0 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 384 KB Integer 0 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Incorrect 11 ms 384 KB Integer 0 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 384 KB Integer 0 violates the range [1, 2]
2 Halted 0 ms 0 KB -