답안 #750232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750232 2023-05-29T08:24:29 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
11 ms 300 KB
#include <iostream>
#include <vector>
#include <utility>
#include <sstream>
#include <climits>
#include <cstring>
#define ll long long
#define ld long double
using namespace std;
const ll mod = 1e9 + 7;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int main()
{
    // freopen("input_text", "r", stdin);
    // freopen("output_text", "w", stdout);
    // ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vi color(n, -1);
    color[0] = 0;
    vi idx({0});
    for (int i = 1; i < n; i++)
    {
        int l = 0, r = idx.size() - 1;
        while (l <= r)
        {
            if (l == r) {
                cout << 2 << " " << idx[l] + 1 << " " << i + 1 << endl;
                int ans;
                cin >> ans;
                if (ans == 1) {
                    color[i] = l;
                } else {
                    color[i] = idx.size();
                    idx.push_back(i);
                }
                break;
            }
            int mid = (l + r) >> 1;
            cout << mid - l + 2 << " ";
            for (int j = l; j <= mid; j++) {
                cout << idx[j] + 1 << " ";
            }
            cout << i + 1 << endl;
            int ans;
            cin >> ans;
            if (ans == mid - l + 2) {
                l = mid + 1;
            } else {
                r = mid;
            }
        }
    }
    cout << "0 ";
    for (int i = 0; i < n; i++) {
        cout << color[i] + 1 << ' ';
    }
    cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 3 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 5 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 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 7 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 9 ms 300 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 8 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 7 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 11 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 11 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct