답안 #475698

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475698 2021-09-23T17:12:07 Z Blobo2_Blobo2 사육제 (CEOI14_carnival) C++14
100 / 100
12 ms 328 KB
/*
Editor: Abdelrahman Hossam
Nickname: Blobo2_Blobo2
IOI next year isA :)
*/
/*#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")*/

#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define endl "\n"
#define all(v)  v.begin(),v.end()
#define gen(arr,n,nxt)  generate(arr,arr+n,nxt)
#define Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty ios_base::sync_with_stdio(false);cin.tie(0);
#define EPS 0.00000001

const int mo=1e9+7,INF=1e18;
int nxt(){int x;cin>>x;return x;}
int ask(vector<int>v){
    cout<<v.size()<<' ';
    for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
    cout<<endl;
    return nxt();
}
signed main(){
    //Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty
    int n=nxt();
    map<int,int>mp;
    vector<int>v;
    vector<int>test={1,2};
    int x = ask(test);
    if(x == 1){
        v.push_back(1);
        mp[1]=1;
        mp[2]=1;
    }
    else
        v.push_back(1),v.push_back(2),mp[1]=1,mp[2]=2;
    int idx=mp[2]+1;
    for(int i=3;i<=n;i++){
        bool ok=0;
        int s = 0,e=v.size()-1;
        while(s<=e){
            int mid = (s+e)/2;
            vector<int>x1;
            for(int i=s;i<=mid;i++)x1.push_back(v[i]);
            x1.push_back(i);
            if(ask(x1)!=x1.size())
                e=mid-1,ok=1;
            else s=mid+1;
        }
        if(!ok){
            v.push_back(i);
            mp[i]=idx;
            idx++;
        }
        else
            mp[i]=mp[v[s]];
    }
    cout<<0<<' ';
    for(int i=1;i<=n;i++)cout<<mp[i]<<' ';
    cout<<endl;
    return 0;
}

Compilation message

carnival.cpp: In function 'long long int ask(std::vector<long long int>)':
carnival.cpp:25:18: 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]
   25 |     for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
      |                 ~^~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:52:23: 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]
   52 |             if(ask(x1)!=x1.size())
      |                ~~~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 10 ms 200 KB Output is correct
4 Correct 10 ms 200 KB Output is correct
5 Correct 3 ms 200 KB Output is correct
6 Correct 2 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 292 KB Output is correct
2 Correct 10 ms 292 KB Output is correct
3 Correct 8 ms 200 KB Output is correct
4 Correct 12 ms 296 KB Output is correct
5 Correct 4 ms 200 KB Output is correct
6 Correct 5 ms 200 KB Output is correct
7 Correct 6 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
3 Correct 7 ms 300 KB Output is correct
4 Correct 12 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 7 ms 200 KB Output is correct
7 Correct 9 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 296 KB Output is correct
2 Correct 3 ms 288 KB Output is correct
3 Correct 10 ms 200 KB Output is correct
4 Correct 10 ms 328 KB Output is correct
5 Correct 7 ms 296 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 9 ms 288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 7 ms 200 KB Output is correct
3 Correct 11 ms 300 KB Output is correct
4 Correct 11 ms 300 KB Output is correct
5 Correct 8 ms 304 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 12 ms 200 KB Output is correct