답안 #50353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
50353 2018-06-10T17:44:43 Z duality Hotter Colder (IOI10_hottercolder) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

// 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(),

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6

// 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 ----------

int bin(int l,int h,int p,int N) {
    if (l == h) return l;

    int n = l+h-p;
    if (n == p) n++;
    if (n < 1) n = 1;
    else if (n > N) n = N;
    int r = Guess(n);
    if (p > n) r = -r;
    if (r == -1) return bin(l,(p+n-1)/2,n,N);
    else if (r == 0) return (p+n)/2;
    else return bin((p+n)/2+1,h,n,N);
}
int rec(int h,int N) {
    if (h == 1) return 1;
    else if (h == 2) {
        Guess(1);
        int r = Guess(2);
        if (r == -1) return 1;
        else return 2;
    }
    else if (h == 3) {
        Guess(1);
        int r = Guess(3);
        if (r == -1) return 1;
        else if (r == 0) return 2;
        else return 3;
    }

    Guess(1);
    int r = Guess((h+1)/2);
    if (r == -1) return rec((h+1)/4,N);
    else if (r == 0) return (h+3)/4;
    else return bin((h+7)/4,h,(h+1)/2,N);
}
int HC(int N) {
    return rec(N,N);
}

Compilation message

hottercolder.cpp: In function 'int bin(int, int, int, int)':
hottercolder.cpp:51:13: error: 'Guess' was not declared in this scope
     int r = Guess(n);
             ^~~~~
hottercolder.cpp: In function 'int rec(int, int)':
hottercolder.cpp:60:9: error: 'Guess' was not declared in this scope
         Guess(1);
         ^~~~~
hottercolder.cpp:66:9: error: 'Guess' was not declared in this scope
         Guess(1);
         ^~~~~
hottercolder.cpp:73:5: error: 'Guess' was not declared in this scope
     Guess(1);
     ^~~~~