답안 #33429

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
33429 2017-10-25T13:51:34 Z imaxblue 사육제 (CEOI14_carnival) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()

int n;
vector<int> com[155];
int query(vector<int> V, vector<int> W){
    cout << V.size()+W.size() << ' ';
    fox(l, V.size()){
        cout << V[l] << ' ';
    }
    fox(l, W.size()){
        cout << W[l] << ' ';
    }
    cout << endl;
    fflush(stdin);
    int x;
    cin >> x;
    return x;
}
int query2(vector<int> V, int L, int R, int X){
    cout << R-L+2 << ' ';
    for(int l=L; l<=R; ++l){
        cout << V[l] << ' ';
    }
    cout << X << ' ';
    cout << endl;
    fflush(stdin);
    int x;
    cin >> x;
    return x;
}
vector<int> dfs(int L, int R){
    if (L==R){
        return vector<int>({R});
    }
    vector<int> v=dfs(L, (L+R)/2), w=dfs((L+R)/2+1, R), u=vector<int>();
    if (query(v, w)!=v.size()+w.size()){
        fox(l, w.size()){
            if (query2(v, 0, v.size()-1, w[l])==v.size()+1){
                u.pb(w[l]);
                continue;
            }
            //continue;
            int L=0, M, R=v.size()-1;
            while(L!=R){
                M=(L+R)/2;
                if (query2(v, L, M, w[l])!=M-L+2) R=M;
                else L=M+1;
            }
            fox(l2, com[w[l]].size()){
                com[v[L]].pb(com[w[l]][l2]);
            }
        }
    } else {
        u=w;
    }
    fox(l, u.size()) v.pb(u[l]);
    //cout << "*" << L << ' ' << R << endl;
    //fox(l, v.size()) cout << v[l] << ' '; cout << endl;
    return v;
}
int main(){
    cin >> n;
    fox1(l, n){
        com[l]=vector<int>({l});
    }
    int ans[155]={0};
    vector<int> v=dfs(1, n);
    fox(l, v.size()){
        fox(l2, com[v[l]].size()){
            ans[com[v[l]][l2]]=l+1;
        }
    }
    cout << "0 ;
    fox1(l, n){
        cout << ans[l] << ' ';
    }
    return 0;
}

Compilation message

carnival.cpp:97:13: warning: missing terminating " character
     cout << "0 ;
             ^
carnival.cpp:97:5: error: missing terminating " character
     cout << "0 ;
     ^
carnival.cpp: In function 'int query(std::vector<int>, std::vector<int>)':
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:31:5: note: in expansion of macro 'fox'
     fox(l, V.size()){
     ^
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:34:5: note: in expansion of macro 'fox'
     fox(l, W.size()){
     ^
carnival.cpp: In function 'std::vector<int> dfs(int, int)':
carnival.cpp:60:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (query(v, w)!=v.size()+w.size()){
                    ^
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:61:9: note: in expansion of macro 'fox'
         fox(l, w.size()){
         ^
carnival.cpp:62:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (query2(v, 0, v.size()-1, w[l])==v.size()+1){
                                               ^
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:73:13: note: in expansion of macro 'fox'
             fox(l2, com[w[l]].size()){
             ^
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:80:5: note: in expansion of macro 'fox'
     fox(l, u.size()) v.pb(u[l]);
     ^
carnival.cpp: In function 'int main()':
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:92:5: note: in expansion of macro 'fox'
     fox(l, v.size()){
     ^
carnival.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
carnival.cpp:93:9: note: in expansion of macro 'fox'
         fox(l2, com[v[l]].size()){
         ^
carnival.cpp:19:20: error: expected primary-expression before 'for'
 #define fox1(k, x) for (int k=1; k<=x; ++k)
                    ^
carnival.cpp:98:5: note: in expansion of macro 'fox1'
     fox1(l, n){
     ^
carnival.cpp:98:10: error: 'l' was not declared in this scope
     fox1(l, n){
          ^
carnival.cpp:19:34: note: in definition of macro 'fox1'
 #define fox1(k, x) for (int k=1; k<=x; ++k)
                                  ^