제출 #572534

#제출 시각아이디문제언어결과실행 시간메모리
572534LunaMeme벽 (IOI14_wall)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "wall.h" using namespace std; typedef pair<int, int> ii; typedef vector<pair<int, int>> vii; typedef vector<int> vi; typedef long long ll; #define PB push_back #define MP make_pair #define FOR(i, x, y) for (int i = x; i < y ; i ++) void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]){ vector<pair<int,ii>> phases; int num_add = 0; while(num_add < k && op[num_add] == 1 ){ phases.PB(MP(left[num_add], MP(height[num_add], right[num_add]))); num_add ++; } sort(phases.begin(), phases.end()); int i_phase = 0; priority_queue<ii> ranges; // (height, right) vi arr(n, 0); FOR(i, 0, n){ while(i_phase < num_add && i == phases[i_phase].first){ ranges.push(phases[i_phase].second); i_phase ++; } while(!ranges.empty() && (int)ranges.top().second() < i){ ranges.pop(); } if (ranges.empty()) arr[i] = 0; else arr[i] = ranges.top().first; } phases.clear(); FOR(i, num_add + 1, k){ phases.PB(MP(left[i], MP(-height[i], right[i]))); } sort(phases.begin(), phases.end()); priority_queue<ii> Ranges; // (height, right) i_phase = 0; FOR(i, 0, n){ while(i_phase < (k -num_add) && i == phases[i_phase].first){ Ranges.push(phases[i_phase].second); i_phase ++; } while(!Ranges.empty() && Ranges.top().second() < i){ Ranges.pop(); } if (!Ranges.empty()) arr[i] = min(arr[i], -Ranges.top().first); } FOR(i, 0, n){ finalHeight[i] = arr[i]; } }

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

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:28:59: error: expression cannot be used as a function
   28 |         while(!ranges.empty() && (int)ranges.top().second() < i){
      |                                                           ^
wall.cpp:46:54: error: expression cannot be used as a function
   46 |         while(!Ranges.empty() && Ranges.top().second() < i){
      |                                                      ^