답안 #918180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918180 2024-01-29T13:23:57 Z vjudge1 사육제 (CEOI14_carnival) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
 
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
#define mpr make_pair
#define eb emplace_back
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define ins insert
#define inf 0x3F3F3F3F
#define infll 0x3F3F3F3F3F3F3F3FLL
#define bpc __builtin_popcount
 
const int LOG = 22;
const int MXN = 150;
const int base = 47;
const int mod = 1e9 + 7;
 
int col[MXN];
int per[MXN];
 
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
const int N=2e5+5, mod=1e9+7;

int col[N] , per[N];  

int main() {
    int n;
    cin >> n;
    col[1] = 1;
    per[1] = 1;
    int cur = 1;
    for(int i = 2; i <= n; i++) {
        cout << cur + 1 << ' ';
        for (int j = 1; j <= cur; j++) cout << per[j] << ' ';
        cout << i << endl;
        int res;
        cin >> res;
        if(res == cur + 1) {
            col[i] = ++cur;
            per[cur] = i;
            continue;
        }
        int l = 1;
        int r = cur;
        while(l < r) {
            int mid = (l + r) >> 1;
            cout << mid + 1 << ' ';
            for (int j = 1; j <= mid; j++) {
                cout << per[j] << ' ';
            }
            cout << i << endl;
            int res;
            cin >> res;
            if(res == mid + 1) {
                l = mid + 1;
            }
            else {
                r = mid;
            }
        }
        per[l] = i;
        col[i] = l;
    }
    cout << 0 << ' ';
    for(int i = 1; i <= n; i++) {
        cout << col[i] << ' ';
    }
    cout << endl;
}
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:40:12: error: a function-definition is not allowed here before '{' token
   40 | int main() {
      |            ^
carnival.cpp:36:20: warning: unused variable 'mod' [-Wunused-variable]
   36 | const int N=2e5+5, mod=1e9+7;
      |                    ^~~
carnival.cpp:38:5: warning: unused variable 'col' [-Wunused-variable]
   38 | int col[N] , per[N];
      |     ^~~
carnival.cpp:38:14: warning: unused variable 'per' [-Wunused-variable]
   38 | int col[N] , per[N];
      |              ^~~