Submission #1214572

#TimeUsernameProblemLanguageResultExecution timeMemory
1214572exoworldgd커다란 상품 (IOI17_prize)C++20
Compilation error
0 ms0 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
map<int,vector<int>> mp;
vector<int> q(int pos) {
    if (mp.count(pos)) return mp[pos];
    return mp[pos] = ask(pos);
}
int find_best(int n) {
    mp.clear();
    int mx = 0, pos = 0;
    for (int i = 0; i < min(n,500); i++) {
        vector<int> res = q(i);
        if (res[0]+res[1] == 0) return i;
        mx = max(mx,res[0]+res[1]);
    }
    while (pos < n) {
        vector<int> res = query(pos);
        if (res[0]+res[1] == 0) return pos;
        if (res[0]+res[1] == mx) pos = res[0]+1;
        else pos++;
	  }
    return 0;
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:18:27: error: 'query' was not declared in this scope
   18 |         vector<int> res = query(pos);
      |                           ^~~~~