답안 #166561

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166561 2019-12-02T19:37:23 Z CaroLinda 사육제 (CEOI14_carnival) C++14
100 / 100
31 ms 380 KB
#include <bits/stdc++.h>

#define lp(i,a,b) for(int i=a;i<b;i++)
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define ll long long

const int MAXN = 155 ;

using namespace std ;

int n ;
int myType[MAXN] ;

bool found(int l, int r, int cur)
{

  if( l > r || l <= cur ) return false ;

  int res1, res2 ;

  cout << r-l+1 << " " ;
  lp(i,l,r+1) cout << i << " " ;
  cout << endl ;
  cin>> res1 ;

  cout << r-l+2 << " " << cur << " " ;
  lp(i,l,r+1) cout << i << " " ;
  cout << endl ;
  cin >> res2 ;

  if(res1 == res2) return true ;
  return false ;
}

int main()
{

  ios_base::sync_with_stdio(false) ;
  cin.tie(NULL) ;

  cin >> n ;

  int cnt = 0 ;

  for(int i = 1 ; i <= n ; i++ )
  {
    if( myType[i] > 0 ) continue ;

    queue<pii> fila ;

    myType[i] = ++cnt ;

    if( !found(i+1,n,i) ) continue ;

    fila.push(mk(i+1,n)) ;

    while(!fila.empty())
    {

      int l = fila.front().ff , r = fila.front().ss , mid ;
      fila.pop() ;

      if( l == r ) { myType[l] = cnt ; continue ; }

      mid=(l+r)>>1 ;

      if( found(l,mid,i) ) fila.push( mk(l,mid) ) ;
      if( found(mid+1, r, i) ) fila.push(mk(mid+1,r)) ;

    }

  }
  cout << "0 ";
  lp(i,1,n+1) cout << myType[i] << " " ;
  cout << endl ;

  return 0 ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 248 KB Output is correct
2 Correct 25 ms 376 KB Output is correct
3 Correct 15 ms 328 KB Output is correct
4 Correct 9 ms 248 KB Output is correct
5 Correct 10 ms 248 KB Output is correct
6 Correct 8 ms 376 KB Output is correct
7 Correct 23 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 252 KB Output is correct
2 Correct 29 ms 376 KB Output is correct
3 Correct 12 ms 376 KB Output is correct
4 Correct 9 ms 248 KB Output is correct
5 Correct 11 ms 380 KB Output is correct
6 Correct 8 ms 248 KB Output is correct
7 Correct 22 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 248 KB Output is correct
2 Correct 21 ms 248 KB Output is correct
3 Correct 15 ms 252 KB Output is correct
4 Correct 8 ms 248 KB Output is correct
5 Correct 13 ms 376 KB Output is correct
6 Correct 10 ms 376 KB Output is correct
7 Correct 31 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 376 KB Output is correct
2 Correct 22 ms 248 KB Output is correct
3 Correct 9 ms 248 KB Output is correct
4 Correct 8 ms 376 KB Output is correct
5 Correct 14 ms 376 KB Output is correct
6 Correct 11 ms 248 KB Output is correct
7 Correct 26 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 248 KB Output is correct
2 Correct 29 ms 248 KB Output is correct
3 Correct 12 ms 248 KB Output is correct
4 Correct 19 ms 376 KB Output is correct
5 Correct 10 ms 296 KB Output is correct
6 Correct 10 ms 248 KB Output is correct
7 Correct 6 ms 376 KB Output is correct