제출 #1073744

#제출 시각아이디문제언어결과실행 시간메모리
1073744shezitt모임들 (IOI18_meetings)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "meetings.h" using ll = long long; #define fore(a, b, c) for(int a=b; a<c; ++a) #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; int T[6050], n; void update(int idx, int x){ T[idx += n] = x; for(idx /= 2; idx; idx /= 2){ T[idx] = max(T[2*idx], T[2*idx+1]); } } int query(int low, int high){ int ra = 0, rb = 0; for(low += n, high += n + 1; low < high; low /= 2, high /= 2){ if(low & 1) ra = max(ra, T[low++]); if(high & 1) rb = max(rb, T[--high]); } return max(ra, rb); } std::vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) { int Q = L.size(); vector<ll> C(Q); int N = 0; for (int j = 0; j < Q; ++j) { N = max(N, R[j]); } N++; assert(N<=3000); n = N; for(int i=0; i<N; ++i){ update(i, H[i]); } for(int j=0; j<Q; ++j){ int l = L[j], r = R[j]; ll ans = 4e18; for(int x=l; x<=r; ++x){ ll cur = 0; for(int i=l; i<=r; ++i){ cur += T.query(i, x); } ans = min(ans, cur); } C[j] = ans; } return C; }

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:56:26: error: request for member 'query' in 'T', which is of non-class type 'int [6050]'
   56 |                 cur += T.query(i, x);
      |                          ^~~~~