Submission #534671

# Submission time Handle Problem Language Result Execution time Memory
534671 2022-03-08T13:47:49 Z YaserFaisal Carnival (CEOI14_carnival) C++17
100 / 100
10 ms 256 KB
#include <bits/stdc++.h> 
 
using namespace std ;
 
#define int long long
#define X first 
#define Y second
#define F first 
#define S second
//#define endl "\n"
#define pii pair < int , int >
 
int pre[155] , ans[155] , v[155] ;
void BS( int l , int r , int cur )
{
    int mid = 0 ; 
    while(l<=r)
    {
        //cout << "   " << l << " " << r << " " << cur << endl ;
        mid = (r+l)/2 ;
        cout << (mid-l+2) << " " << cur << " " ;
        for ( int i = l ; i <= mid ; i++ ) cout << v[i] << " " ;
        cout << endl ;
        int x ; cin >> x ;
        if ( x == (mid-l+2) ) l = mid+1 ;
        else r = mid-1 ;
    }
    ans[cur] = ans[v[l]] ;
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n ; cin >> n ; 
    int c = 0 ;
    for ( int i = 1 ; i <= n ; i++ )
    {
        cout << i << " " ;
        for ( int j = 1 ; j <= i ; j++ ) cout << j << " " ;
        cout << endl ;
        cin >> pre[i] ;
        if ( pre[i] != pre[i-1] )
        {
            c++ ;
            ans[i] = c ;
            v[c] = i ;
        }
        else BS( 1 , c , i ) ;
    }
    cout << 0 << " " ;
    for ( int i = 1 ; i <= n ; i++ ) cout << ans[i] << " " ;
    cout << endl ;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 3 ms 200 KB Output is correct
7 Correct 6 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 6 ms 200 KB Output is correct
7 Correct 7 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 10 ms 200 KB Output is correct
3 Correct 9 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 7 ms 200 KB Output is correct
7 Correct 9 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 4 ms 200 KB Output is correct
7 Correct 8 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 7 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 4 ms 200 KB Output is correct
7 Correct 3 ms 200 KB Output is correct