#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;
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 != ans[i - 1] )
ans[i] = val++ , dis.push_back(i);
}
for( int i = 1 ; i <= n ; i++ ){
if(ans[i] == 0){
for(int j = 0 ; j < dis.size() ; 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 << ' ';
return 0 ;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:29:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for(int j = 0 ; j < dis.size() ; j++ ){
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
312 KB |
Integer 12 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
312 KB |
Integer 6 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
208 KB |
Integer 2 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
208 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
312 KB |
Integer 3 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |