Submission #996006

#TimeUsernameProblemLanguageResultExecution timeMemory
996006vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
7 ms600 KiB
//#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 (stderr)

carnival.cpp: In function 'void Test_Case()':
carnival.cpp:42:28: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   42 |                 ii mid = l + r >> 1 ;
      |                          ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...