Submission #616128

# Submission time Handle Problem Language Result Execution time Memory
616128 2022-07-31T23:24:39 Z 3omar_ahmed Carnival (CEOI14_carnival) C++17
100 / 100
20 ms 320 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std ;
using namespace __gnu_pbds;

#define int long long
#define ordered_set tree<pair < int ,int >,null_type,less<pair < int ,int >>,rb_tree_tag,tree_order_statistics_node_update>
#define all(a) a.begin() , a.end()
#define alr(a) a.rbegin() , a.rend()

signed main(){
    ios_base::sync_with_stdio(0), cin.tie(0),cout.tie(0);

    int n ; cin >> n;
    vector < int > ans(n + 1) , dis;
    int val = 1, lst = 0;
    for( int i = 1 ; i <= n ; i++ ){
        cout << i << ' ';
        for( int j = 1 ; j <= i ; j++ ) cout << j << ' ';
        cout << endl ;
        int x; cin >> x;
        if( x - 1 == lst )
            ans[i] = val++ , dis.push_back(i);
        else{
            for( auto j : dis ){
                cout << 2 << ' ' << i << ' ' << j << endl;
                int y ; cin >> y;
                if( y == 1 ){
                    ans[i] = ans[j] ;
                    break ;
                }
            }
        }
        lst = x ;
    }
//    for( int i = 1 ; i <= n ; i++ ){
//        if(ans[i] == 0){
//            for(int j = 0 ; j < (int)(dis.size()) && dis[j] < i ; j++ ){
//                cout << 2 << ' ' << i << ' ' << dis[j] << endl ;
//                int x ; cin >> x;
//                if( x == 1 ){
//                    ans[i] = ans[dis[j]] ;
//                    break ;
//                }
//            }
//        }
//    }
    for( int i : ans ) cout << i << ' '; cout << endl ;
    return 0 ;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:50:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   50 |     for( int i : ans ) cout << i << ' '; cout << endl ;
      |     ^~~
carnival.cpp:50:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   50 |     for( int i : ans ) cout << i << ' '; cout << endl ;
      |                                          ^~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 208 KB Output is correct
2 Correct 12 ms 208 KB Output is correct
3 Correct 12 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 13 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 3 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 8 ms 252 KB Output is correct
3 Correct 16 ms 312 KB Output is correct
4 Correct 5 ms 316 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 16 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 9 ms 312 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 3 ms 316 KB Output is correct
7 Correct 12 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 20 ms 316 KB Output is correct
4 Correct 11 ms 208 KB Output is correct
5 Correct 2 ms 316 KB Output is correct
6 Correct 2 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct