답안 #99330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99330 2019-03-02T15:34:17 Z long10024070 사육제 (CEOI14_carnival) C++11
100 / 100
45 ms 420 KB
#define Link "https://oj.uz/problem/view/CEOI14_carnival?fbclid=IwAR1nvQ7Ibq-nGYUPmX75LbvZGOpdx2hLsTE0ATdCwf9cC2bkAG_Ss27JVJc"

#include <iostream>
#include <cstdio>

#define TASK "Carnival"

using namespace std;

const int maxn = 2e2 + 10;
int n,c[maxn],cnt;

void Enter()
{
    cin >> n;
}

void Init()
{

}

int ASK(int l, int r, int d)
{
    if (d == 0)
        cout << r - l + 1;
    else
        cout << r - l + 2;
    for (int i=l;i<=r;++i)
        cout << ' ' << i;
    if (d != 0)
        cout << ' ' << d;
    cout << endl;
    int res = 0;
    cin >> res;
    return res;
}

void ANSWER()
{
    for (int i=0;i<=n;++i)
        cout << c[i] << ' ';
    cout << endl;
}

void Solve()
{
    for (int i=1;i<=n;++i) {
        if (ASK(1,i,0) != cnt)
            c[i] = ++cnt;
        else {
            int l = 1;
            int r = i - 1;
            while (l <= r) {
                int m = (l + r) / 2;
                if (ASK(1,m,0) < ASK(1,m,i))
                    l = m + 1;
                else
                    r = m - 1;
            }
            c[i] = c[l];
        }
    }
    ANSWER();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

#ifdef LHL
    freopen(".INP","r",stdin);
    freopen(".OUT","w",stdout);
#else
//    freopen(TASK".INP","r",stdin);
//    freopen(TASK".OUT","w",stdout);
#endif // LHL

    Enter();
    Init();
    Solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 256 KB Output is correct
2 Correct 18 ms 256 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 22 ms 256 KB Output is correct
6 Correct 45 ms 284 KB Output is correct
7 Correct 22 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 19 ms 256 KB Output is correct
3 Correct 12 ms 256 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 21 ms 384 KB Output is correct
6 Correct 20 ms 256 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 384 KB Output is correct
2 Correct 20 ms 256 KB Output is correct
3 Correct 17 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 17 ms 256 KB Output is correct
6 Correct 14 ms 384 KB Output is correct
7 Correct 17 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 256 KB Output is correct
2 Correct 16 ms 420 KB Output is correct
3 Correct 10 ms 256 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 14 ms 384 KB Output is correct
6 Correct 11 ms 256 KB Output is correct
7 Correct 19 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 384 KB Output is correct
2 Correct 23 ms 384 KB Output is correct
3 Correct 13 ms 304 KB Output is correct
4 Correct 13 ms 384 KB Output is correct
5 Correct 11 ms 256 KB Output is correct
6 Correct 9 ms 384 KB Output is correct
7 Correct 5 ms 256 KB Output is correct