Submission #587122

# Submission time Handle Problem Language Result Execution time Memory
587122 2022-07-01T10:51:10 Z ygim Carnival (CEOI14_carnival) C++17
100 / 100
7 ms 320 KB
// P1_Carnival.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
 
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <math.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vp;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
 
    int n; cin >> n;
    vp groups;
    vi costumes(n, -1);
    int c = 1;
    groups.push_back({ 0, 1 });
    costumes[0] = 1;
    for (int i = 1; i < n; i++)
    {
        cout << groups.size() + 1 << " ";
        for (pii p : groups) cout << p.first + 1 << " ";
        cout << i + 1 << endl;
        int t; cin >> t;
        if (t == groups.size())
        {
            int l = 0, r = groups.size() - 1, mid = (l+r)/2;
            while (l < r)
            {
                mid = (l + r) / 2;
                cout << mid - l + 2 << " ";
                for (int j = l; j <= mid; j++) cout << groups[j].first + 1 << " ";
                cout << i + 1 << endl;
                int t; cin >> t;
                if (t == mid - l + 2) l = mid + 1;
                else r = mid;
            }
            costumes[i] = groups[l].second;
        }
        else
        {
            groups.push_back({ i, ++c });
            costumes[i] = c;
        }
    }
    cout << 0 << " ";
    for (int i : costumes) cout << i << " ";
    cout << endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:31:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if (t == groups.size())
      |             ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 4 ms 316 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 4 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 3 ms 316 KB Output is correct
4 Correct 2 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 5 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 2 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 3 ms 208 KB Output is correct
3 Correct 5 ms 320 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 4 ms 316 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 7 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 4 ms 316 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct