제출 #963752

#제출 시각아이디문제언어결과실행 시간메모리
963752Trisanu_DasFountain (eJOI20_fountain)C++17
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define int long long int n, q, jump[100005][20], h2o[100005][20]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> q; priority_queue<pair<int, int>, greater<pair<int, int> > pq; for(int i = 1; i <= n; i++){ int d; cin >> d >> h2o[i][0]; while(!pq.empty() && pq.top().ff < d){ jump[pq.top().ss][0] = i; pq.pop(); } pq.push({d, i}); } while(!pq.empty()){ jump[pq.top().ss][0] = 0; pq.pop(); } jump[0][0] = 0; h2o[0][0] = 0; for(int j = 1; j < 20; j++) for(int i = 0; i <= n; i++){ jump[i][j] = jump[[i][j - 1]][j - 1]; h20[i][j] = h2o[i][j - 1] + h20[jump[i][j - 1]][j - 1]; } while(q--){ int r, v; cin >> r >> v; for(int i = 19; i >= 0; i++){ if(h2o[r][i] > v) continue; v -= h20[r][i]; r = jump[r][i]; } cout << r << '\n'; } }

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

fountain.cpp: In function 'int main()':
fountain.cpp:12:59: error: template argument 2 is invalid
   12 |   priority_queue<pair<int, int>, greater<pair<int, int> > pq;
      |                                                           ^~
fountain.cpp:12:59: error: template argument 3 is invalid
fountain.cpp:15:12: error: 'pq' was not declared in this scope; did you mean 'q'?
   15 |     while(!pq.empty() && pq.top().ff < d){
      |            ^~
      |            q
fountain.cpp:19:5: error: 'pq' was not declared in this scope; did you mean 'q'?
   19 |     pq.push({d, i});
      |     ^~
      |     q
fountain.cpp:21:10: error: 'pq' was not declared in this scope; did you mean 'q'?
   21 |   while(!pq.empty()){
      |          ^~
      |          q
fountain.cpp:28:24: error: two consecutive '[' shall only introduce an attribute before '[' token
   28 |       jump[i][j] = jump[[i][j - 1]][j - 1];
      |                        ^
fountain.cpp:29:7: error: 'h20' was not declared in this scope; did you mean 'h2o'?
   29 |       h20[i][j] = h2o[i][j - 1] + h20[jump[i][j - 1]][j - 1];
      |       ^~~
      |       h2o
fountain.cpp:36:12: error: 'h20' was not declared in this scope; did you mean 'h2o'?
   36 |       v -= h20[r][i];
      |            ^~~
      |            h2o