Submission #775781

# Submission time Handle Problem Language Result Execution time Memory
775781 2023-07-06T22:52:56 Z Pichon5 Carnival (CEOI14_carnival) C++17
100 / 100
9 ms 336 KB
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <bits/stdc++.h>
#define lcm(a,b) (a/__gcd(a,b))*b
#define ke ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define F first
#define S second
#define vi vector<int>
#define ll long long
using namespace std;

int queryRange(int izq, int der){
    cout<<der-izq+1<<" ";
    for(int i=izq;i<=der;i++){
        cout<<i<<" ";
    }
    cout<<endl;
    int x;
    cin>>x;
    return x;
}
vi v;
int queryV(int m, int j){
    cout<<m+2<<" ";
    for(int i=0;i<=m;i++){
        cout<<v[i]<<" ";
    }
    cout<<j<<" ";
    cout<<endl;
    int x;
    cin>>x;
    return x;
}
int main(){
    ke
    int n;
    cin>>n;
    vi res;
    for(int i=1;i<=n;i++){
        int y=queryRange(1,i);
        if(y>(int)v.size()){
            res.pb(y);
            v.pb(i);
        }else{
            int b=0,e=v.size()-1;
            int cualEs=0;
            while(b<=e){
                int mid=(b+e)/2;
                int x=queryV(mid,i);
                if(mid+1==x){
                    cualEs=mid;
                    e=mid-1;
                }else{
                    b=mid+1;
                }
            }
            res.pb(res[v[cualEs]-1]);
        }
    }
    cout<<0<<" ";
    for(int i=0;i<res.size();i++){
        cout<<res[i]<<" ";
    }
    cout<<endl;
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:74:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |     for(int i=0;i<res.size();i++){
      |                 ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 7 ms 312 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 2 ms 312 KB Output is correct
5 Correct 4 ms 316 KB Output is correct
6 Correct 3 ms 312 KB Output is correct
7 Correct 5 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 312 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 3 ms 312 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 5 ms 208 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 3 ms 208 KB Output is correct
2 Correct 5 ms 316 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 5 ms 316 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 5 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 6 ms 316 KB Output is correct
3 Correct 3 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 6 ms 316 KB Output is correct
6 Correct 4 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 316 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 5 ms 320 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct