답안 #996006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996006 2024-06-10T07:05:21 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
7 ms 600 KB
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define ii int
#define pb push_back
#define fi first
#define se second
#define Op operator
#define bp __builtin_popcount
#define Faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define nn cout<<"NO"<<endl;
#define yy cout<<"YES"<<endl;
#define rep() for(ll i=1 ; i<=n ; i++) cin>>a[i];
#define End() for(ll i=1 ; i<=n ; i++) cout<<a[i]<<" ";
#define TT ll tt;cin>>tt;while(tt--){Test_Case();}
#define T Test_Case() ;
using namespace std;
const ii N = 2e5 , M = 1e6 , mod = 1e9 + 7 , Ones = 1 , Zero = 0;
const ll oo = 1e18 ;
ii Pre[155] , c[155] ;
void Test_Case(){
    ii n , pos = 0 ; cin >> n ;
    vector<ii> v ;
    for(ii i = 1 ; i <= n ; i ++ ) {
        cout << i << " " ;
        for(ii j = 1 ; j <= i ; j ++ ) {
            cout << j << " " ;
        }
        cout << endl ;
        cin >> Pre[i] ;
    }
    for(ii i = 1 ; i <= n ; i ++ ) {
        if(Pre[i] != Pre[i - 1]) {
            c[i] = ++pos ; v.pb(i) ;
        }
        else {
            ii l = 1 , r = v.size() , idx = 0 ;
            while(l <= r) {
                ii mid = l + r >> 1 ;
                cout << mid + 1 << " " ;
                for(ii j = 0 ; j < mid ; j ++ ) {
                    cout << v[j] << " " ;
                }
                cout << i << endl ; ii sz ; cin >> sz ;
                if(sz == mid) {
                    idx = mid - 1 ; r = mid - 1 ;
                }
                else l = mid + 1 ;
            }
            c[i] = c[v[idx]] ;
        }
    }
    cout << 0 << " " ;
    for(ii i = 1 ; i <= n ; i ++ ) {
        cout << c[i] << " " ;
    }
    cout << endl ;
}
int main(){
    //Faster
    //freopen("???.inp", "r", stdin);
    //freopen("???.out", "w", stdout);
    T ;
    cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
}
////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                Coded by SkyZCoder                                                                                                                                                                                                                                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Compilation message

carnival.cpp: In function 'void Test_Case()':
carnival.cpp:42:28: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   42 |                 ii mid = l + r >> 1 ;
      |                          ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 436 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 440 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 5 ms 600 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 3 ms 444 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 600 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 2 ms 440 KB Output is correct