Submission #710001

# Submission time Handle Problem Language Result Execution time Memory
710001 2023-03-15T02:54:44 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
8 ms 360 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;

#define LOCALIO "C:/Users/admin/Documents/Code/"

ll a[200];
vector <ll> col;

ll ask(vector <ll> a, ll y)
{
    a.pb(y);
    cout << a.size() << " ";
    for (ll i:a) cout << i << " ";
    cout << endl;
    ll x; cin >> x;
    return x;
}


int main()
{
    ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
    ll n; cin >> n;
    col.pb(1); a[1]=1;
    for (ll i=2; i<=n; i++)
    {
        if (ask(col, i)==col.size()+1)
        {
            col.pb(i);
            a[i]=col.size();
            continue;
        }
        ll lo=0, hi=col.size()-1;
        while (hi>lo)
        {
            ll mid=(hi+lo)/2;
            vector <ll> col1(col.begin()+lo, col.begin()+mid+1);
            if (ask(col1, i)==mid-lo+2)
                lo=mid+1;
            else hi=mid;
        }
        a[i]=a[col[lo]];
    }
    cout << 0 << " ";
    for (ll i=1; i<=n; i++)
        cout << a[i] << " ";
    cout << endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:35:24: 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]
   35 |         if (ask(col, i)==col.size()+1)
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 3 ms 208 KB Output is correct
6 Correct 2 ms 208 KB Output is correct
7 Correct 5 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 208 KB Output is correct
3 Correct 3 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 6 ms 316 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 7 ms 328 KB Output is correct
7 Correct 8 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 8 ms 328 KB Output is correct
6 Correct 7 ms 352 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 6 ms 316 KB Output is correct
3 Correct 6 ms 336 KB Output is correct
4 Correct 5 ms 352 KB Output is correct
5 Correct 6 ms 336 KB Output is correct
6 Correct 3 ms 336 KB Output is correct
7 Correct 3 ms 360 KB Output is correct