답안 #78638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
78638 2018-10-06T18:24:03 Z duality 사육제 (CEOI14_carnival) C++11
100 / 100
17 ms 568 KB
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

vi ind;
int ans[150];
int findAns(int l,int r,int c) {
    if (l > r) return 0;
    int i,x,y;
    cout << r-l+1;
    for (i = l; i <= r; i++) cout << " " << ind[i]+1;
    cout << endl;
    cin >> x;
    cout << r-l+2;
    for (i = l; i <= r; i++) cout << " " << ind[i]+1;
    cout << " " << ind[0]+1 << endl;
    cin >> y;
    if (x == y) {
        if (l == r) ans[ind[l]] = c;
        else {
            int m = (l+r) / 2;
            findAns(l,m,c),findAns(m+1,r,c);
        }
    }
    return 0;
}
int main() {
    int N;
    cin >> N;

    int i,j;
    cout << N;
    for (i = 0; i < N; i++) cout << " " << i+1,ind.pb(i);
    cout << endl;
    int C;
    cin >> C;
    for (i = 0; i < C; i++) {
        ans[ind[0]] = i+1;
        findAns(1,ind.size()-1,i+1);
        ind.clear();
        for (j = 0; j < N; j++) {
            if (ans[j] == 0) ind.pb(j);
        }
    }
    cout << 0;
    for (i = 0; i < N; i++) cout << " " << ans[i];
    cout << endl;

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 248 KB Output is correct
2 Correct 15 ms 328 KB Output is correct
3 Correct 8 ms 400 KB Output is correct
4 Correct 6 ms 476 KB Output is correct
5 Correct 7 ms 476 KB Output is correct
6 Correct 5 ms 552 KB Output is correct
7 Correct 15 ms 552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 552 KB Output is correct
2 Correct 11 ms 552 KB Output is correct
3 Correct 12 ms 552 KB Output is correct
4 Correct 8 ms 552 KB Output is correct
5 Correct 8 ms 552 KB Output is correct
6 Correct 4 ms 568 KB Output is correct
7 Correct 9 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 568 KB Output is correct
2 Correct 8 ms 568 KB Output is correct
3 Correct 11 ms 568 KB Output is correct
4 Correct 7 ms 568 KB Output is correct
5 Correct 8 ms 568 KB Output is correct
6 Correct 7 ms 568 KB Output is correct
7 Correct 17 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 568 KB Output is correct
2 Correct 7 ms 568 KB Output is correct
3 Correct 11 ms 568 KB Output is correct
4 Correct 5 ms 568 KB Output is correct
5 Correct 8 ms 568 KB Output is correct
6 Correct 8 ms 568 KB Output is correct
7 Correct 16 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 568 KB Output is correct
2 Correct 16 ms 568 KB Output is correct
3 Correct 10 ms 568 KB Output is correct
4 Correct 13 ms 568 KB Output is correct
5 Correct 8 ms 568 KB Output is correct
6 Correct 8 ms 568 KB Output is correct
7 Correct 8 ms 568 KB Output is correct