답안 #575053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
575053 2022-06-09T14:49:29 Z AbdullahMW 사육제 (CEOI14_carnival) C++14
100 / 100
18 ms 304 KB
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
 
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
 
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
 
#define all(vec) vec.begin(), vec.end()
#define ll long long
#define db double
#define pb push_back
#define pf push_front
#define newl "\n"
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;
 
#pragma GCC diagnostic ignored "-Wunused-result"
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << fixed << setprecision(15);
    if (name.size()) {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}



int main()
{
    //fast
    //setIO("");
    
    ll n; cin >> n;
    
    vector <ll> occ(n + 1), vec;
    occ[1] = 1;
    vec.pb(1);
    for (ll i = 2; i <= n; i++)
    {        
        cout << vec.size() + 1 << ' ';
        for (auto v : vec) cout << v << ' ';
        cout << i << ' ' << endl;
        ll nm; cin >> nm;
        
        if (nm == vec.size() + 1) 
        {
            occ[i] = vec.size() + 1;
            vec.pb(i);
            continue;
        }
        
        ll l = 0, r = vec.size() - 1;
        while (l < r)
        {
            ll m = (l + r) / 2;
            
            ll sz1 = m - l + 1;
            ll sz2 = r - (m + 1) + 1;
            
            cout << sz1 + 1 << ' ';
            for (ll j = l; j <= m; j++) cout << vec[j] << ' ';
            cout << i << ' ' << endl;
            ll x; cin >> x;
            
            cout << sz2 + 1 << ' ';
            for (ll j = m + 1; j <= r; j++) cout << vec[j] << ' ';
            cout << i << ' ' << endl;
            ll y; cin >> y;
            
            if (sz1 > sz2) x--;
            else if (sz2 > sz1) y--;
            
            if (x > y) 
            {
                l = m + 1;
            }
            else r = m;
        }
        
        //cout << "WOWOWOWOWOW" << ' ' << vec[l] << newl;
        occ[i] = occ[vec[l]];
    }
    
    cout << 0 << ' ';
    for (ll i = 1; i <= n; i++) cout << occ[i] << ' ';
    cout << endl;

}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:129:16: 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]
  129 |         if (nm == vec.size() + 1)
      |             ~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 208 KB Output is correct
2 Correct 18 ms 208 KB Output is correct
3 Correct 6 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 5 ms 208 KB Output is correct
7 Correct 9 ms 276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 13 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 13 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 12 ms 304 KB Output is correct
7 Correct 14 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 8 ms 300 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 10 ms 208 KB Output is correct
6 Correct 9 ms 296 KB Output is correct
7 Correct 13 ms 280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 11 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 8 ms 304 KB Output is correct
7 Correct 5 ms 208 KB Output is correct