제출 #265053

#제출 시각아이디문제언어결과실행 시간메모리
265053arayi커다란 상품 (IOI17_prize)C++17
컴파일 에러
0 ms0 KiB
#include "prize.h" #include <algorithm> #include <chrono> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); const int N = 2e5 + 55; int dz[N], aj[N]; bool col[N]; int mx; int as(int a) { vector <int> fp = ask(a); if(fp[0] + fp[1] == 0) return 0; if(!col[a] && fp[0] + fp[1] < mx) return 2; if(fp[0] - dz[a]) return -1; return 1; } int find_best(int n) { for (int i = 0; i < 500; i++) { int i1 = rnd() % n; vector <int> fp = ask(i1); mx = max(mx, fp[0] + fp[1]); } while(true) { int l = 0, r = n - 1; while(l <= r) { int mid = (l + r)/2; int sm = as(mid); if(sm == 0) return mid; if(sm == 2) { for (int i = mid + 1; i < n; i++) dz[i]++; for (int i = mid - 1; i >= 0; i--) aj[i]++; col[mid] = true; break; } if(sm == 1) l = mid + 1; if(sm == -1) r = mid - 1; } } }

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

prize.cpp:5:1: error: 'mt19937' does not name a type
    5 | mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
      | ^~~~~~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:24:17: error: 'rnd' was not declared in this scope; did you mean 'rand'?
   24 |        int i1 = rnd() % n;
      |                 ^~~
      |                 rand