Submission #995887

# Submission time Handle Problem Language Result Execution time Memory
995887 2024-06-10T03:24:03 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
16 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pll pair<long long, long long>
#define pb push_back
#define F first
#define S second  
#define all(x) (x).begin(), (x).end()
 
const ll N = 2e5 + 100;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll block = 500;
const ll base = 31;
ll n;
ll p[N], a[N];
void to_nho_cau(){
    cin >> n;
    ll d = 1;
    a[1] = 1;
    for(int i = 2; i <= n;i++){
        ll l = 1, r = i - 1, res = -1;
        while(l <= r){
            ll mid = (l + r) / 2;
            cout << i - mid + 1 << ' ';
            for(int j = mid; j <= i;j++) cout << j << ' ';
            cout << endl;
            ll x; cin >> x;
            cout << i - mid << ' ';
            for(int j = mid; j <= i - 1;j++) cout << j << ' ';
            cout << endl;
            ll y; cin >> y;
            if(x == y){
                res = mid;
                l = mid + 1;
            }
            else r = mid - 1;
        }
        if(res == -1) a[i] = ++d;
        else a[i] = a[res];
    }
    cout << 0 << ' ';
    for(int i = 1; i <= n;i++) cout << a[i] << ' ';
    cout << endl;
}           

signed main()
{   
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) to_nho_cau();
    return 0;
}  
# Verdict Execution time Memory Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 13 ms 344 KB Output is correct
3 Correct 9 ms 344 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
5 Correct 11 ms 344 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 10 ms 344 KB Output is correct
4 Correct 11 ms 344 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 344 KB Output is correct
2 Correct 11 ms 344 KB Output is correct
3 Correct 11 ms 344 KB Output is correct
4 Correct 12 ms 344 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 16 ms 344 KB Output is correct
7 Correct 14 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 9 ms 344 KB Output is correct
3 Correct 13 ms 344 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
5 Correct 15 ms 344 KB Output is correct
6 Correct 16 ms 344 KB Output is correct
7 Correct 11 ms 344 KB Output is correct