Submission #702856

# Submission time Handle Problem Language Result Execution time Memory
702856 2023-02-25T09:09:08 Z kxd Carnival (CEOI14_carnival) C++17
100 / 100
10 ms 316 KB
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define pb push_back
#define p_q priority_queue
#define m_p make_pair
#define pii pair<int,int>
#define endl '\n'
#define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(),x.end()
#define ft first
#define sd second

using namespace std;
const int N = 1e5+5;
const int INF = 1e18;
const int MOD = 1e9+7;

int c[N];
vector<int> v;
bool bl[N];
 
signed main() {
    //INIT
    int n;
    cin >> n;
    v.pb(1);
    c[1] = 1;
    int t;
    for (int i = 2; i <= n; i++) {
        cout << v.size()+1 << ' ';
        for (auto x: v) {
        	cout << x << ' ';
		}
        cout << i << endl;
        cin >> t;
        if (t > v.size()) {
        	bl[i] = 1;
			v.pb(i);
			c[i] = v.size();
		}
    }
    int ans = -1;
    for (int i = 2; i <= n; i++) {
        if (bl[i]) continue;
        int lo = 0, hi = v.size()-1;
        while (lo <= hi) {
            int mid = (lo+hi)/2;
            cout << mid+2 << ' ';
            for (int i = 0; i <= mid; i++) {
            	cout << v[i] << ' ';
			}
            cout << i << endl;
            cin >> t;
            if (t == mid + 2) lo = mid + 1;
            else {
            	ans = mid;
				hi = mid - 1;
			}
        }
        c[i] = c[v[ans]];
    }
    cout << 0 << ' ';
    for (int i = 1; i <= n; i++) {
    	cout << c[i] << ' ';
	}
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:40:15: 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]
   40 |         if (t > v.size()) {
      |             ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 4 ms 308 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 304 KB Output is correct
2 Correct 10 ms 308 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 8 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 8 ms 312 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 4 ms 312 KB Output is correct
6 Correct 4 ms 316 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 308 KB Output is correct
5 Correct 7 ms 316 KB Output is correct
6 Correct 5 ms 312 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 7 ms 308 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 3 ms 308 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct