제출 #1172450

#제출 시각아이디문제언어결과실행 시간메모리
1172450mateuszwesMinerals (JOI19_minerals)C++20
컴파일 에러
0 ms0 KiB
#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define ull unsigned ll
#define pq priority_queue
#define pb push_back
#define all(x) x.begin(), x.end()
#define deb(x) if(debug) cerr << #x << " = " << x << '\n';
#define deb2(x,y) if(debug) cerr << #x << " = " << x << ", " << #y << " = " << y << '\n';

constexpr int N = 1e5+7;
constexpr int debug = 0;

stack<int> totake;
bool chek[N];
int sq;
int prv = 0, nxt = 0;
int rem;


void ans(int x){
    stack<int> re;
    int tok = 0;
    while(!totake.empty()){
        tok = totake.top();
        totake.pop();
        nxt = Query(tok);
        if(nxt == prv) break;
        re.push(tok);
        prv = nxt;
    }
    prv = nxt;
    Answer(x, tok);
    rem -= 2;
    deb2(x, tok);
    chek[x] = 1;
    chek[tok] = 1;

    nxt = prv = Query(x);
    while(!re.empty()){
        totake.push(re.top());
        nxt = prv = Query(re.top());
        re.pop();
    }
}

void put(int x){
    nxt = Query(x);
    if(nxt == prv){
        ans(x);
    }
    else if(nxt > prev){
        totake.push(x);
    }
    else totake.pop();
    prv = nxt;
}

void Solve(int n) {
    rem = 2*n;
    sq = sqrt(n)+1;
    int siz = 0;
    int ob = 1;
    while(ob <= 2*n){
        if(rem == 0) return;
        while(prv < sq){
            if(!chek[ob]) put(ob);
            ob++;
            if(ob > 2*n) break;
            if(rem == 0) return;
        }
        for(int i = ob+1; i <= 2*n; i++){
            if(chek[i]) continue;
            if(prv == 0) break;
            put(i);
            if(!chek(i)) put(i);
            if(rem == 0) return;
        }
    }
    
}

컴파일 시 표준 에러 (stderr) 메시지

minerals.cpp: In function 'void put(int)':
minerals.cpp:55:17: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
   55 |     else if(nxt > prev){
      |             ~~~~^~~~~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:79:21: error: 'chek' cannot be used as a function
   79 |             if(!chek(i)) put(i);
      |                 ~~~~^~~