제출 #1175439

#제출 시각아이디문제언어결과실행 시간메모리
1175439mannshah1211The Big Prize (IOI17_prize)C++20
컴파일 에러
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; int find_best(int n) { vector<vector<int>> cache(n, vector<int>(2, -1)); auto uwu = [&](int i) { if (cache[i] != {-1, -1}) { return cache[i]; } return cache[i] = ask(i); }; int mx = 0, ptr = 0; while (ptr < n) { vector<int> v = uwu(ptr); if (v[0] + v[1] == 0) { return ptr; } if (v[0] == ptr) { mx = v[0] + v[1]; break; } ptr++; } while (ptr < n) { vector<int> v1 = uwu(ptr); if (v1[0] + v1[1] == mx) { int low = ptr + 1, high = n - 1, idx = -1; while (low <= high) { int mid = (low + high) >> 1; vector<int> v2 = uwu(mid); if (v2[1] == v1[1]) { low = mid + 1; } else { idx = mid; high = mid - 1; } } assert(idx != -1); ptr = idx + 1; } else { ptr += 1; } } }

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

prize.cpp: In lambda function:
prize.cpp:9:21: error: expected primary-expression before '{' token
    9 |     if (cache[i] != {-1, -1}) {
      |                     ^
prize.cpp:9:20: error: expected ')' before '{' token
    9 |     if (cache[i] != {-1, -1}) {
      |        ~           ^~
      |                    )
prize.cpp: In function 'int find_best(int)':
prize.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^