답안 #162122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
162122 2019-11-06T14:41:10 Z alexandra_udristoiu CEOI16_icc (CEOI16_icc) C++14
컴파일 오류
0 ms 0 KB
#include<iostream>
#include "icc.h"
using namespace std;
static int c[105], v1[105], v2[105];
static void solve(int m1, int v1[], int m2, int v2[]){
    int i, mid;
    while(m1 > 1){
        mid = m1 / 2;
        if(query(mid, m2, v1, v2) == 1){
            m1 = mid;
        }
        else{
            for(i = mid; i < m1; i++){
                v1[i - mid] = v1[i];
            }
            m1 -= mid;
        }
    }
}
void run(int n){
    int nr, i, ii, m1, m2, k;
    nr = n;
    for(i = 1; i <= n; i++){
        c[i] = i;
    }
    for(k = 1; k < n; k++){
        for(ii = 0; (1 << ii) < nr; ii++){
            m1 = m2 = 0;
            for(i = 1; i <= n; i++){
                if( ( (c[i] >> ii) & 1) == 0){
                    v1[m1++] = i;
                }
                else{
                    v2[m2++] = i;
                }
            }
            if(query(m1, m2, v1, v2) == 1){
                break;
            }
        }
        m1 = m2 = 0;
        for(i = 1; i <= n; i++){
            if( ( (c[i] >> ii) & 1) == 0){
                v1[m1++] = i;
            }
            else{
                v2[m2++] = i;
            }
        }
        solve(m1, v1, m2, v2);
        solve(m2, v2, m1, v1);
        x = v1[0];
        y = v2[0];
        setRoad(x, y);
        if(c[x] > c[y]){
            swap(x, y);
        }
        for(i = 1; i <= n; i++){
            if(i != y && c[i] == c[y]){
                c[i] = c[x];
            }
            else{
                if(c[i] > c[y]){
                    c[i]--;
                }
            }
        }
        c[y] = c[x];
        nr--;
    }
}

Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:52:9: error: 'x' was not declared in this scope
         x = v1[0];
         ^
icc.cpp:53:9: error: 'y' was not declared in this scope
         y = v2[0];
         ^