제출 #329135

#제출 시각아이디문제언어결과실행 시간메모리
329135mat_vHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define maxn 200005 using namespace std; int n,m; int niz[maxn]; int seg[4 * maxn]; vector<int> mst[4 * maxn]; void merg(int x, int y, int z){ int br1 = 0; int br2 = 0; int p1 = mst[y].size(); int p2 = mst[z].size(); while(br1 < p1 || br2 < p2){ if(br1 == p1){ mst[x].pb(mst[z][br2]); br2++; continue; } if(br2 == p2){ mst[x].pb(mst[y][br1]); br1++; continue; } if(mst[y][br1] < mst[z][br2])mst[x].pb(mst[y][br1++]); else mst[x].pb(mst[z][br2++]); } } void init(int node, int l, int r){ if(l == r){ seg[node] = niz[l]; mst[node].pb(niz[l]); return; } int mid = (l + r) / 2; init(node * 2, l, mid); init(node * 2 + 1, mid + 1, r); merg(node, node * 2, node * 2 + 1); seg[node] = max(seg[node * 2], seg[node * 2 + 1]); } int query(int node, int l, int r, int levo, int desno, int targ){ } int main() { ios_base::sync_with_stdio(false); cin >> n >> m; ff(i,1,n){ cin >> niz[i]; } init(1,1,n); ff(i,1,m){ int l,r,x; cin >> l >> r >> x; int sta = query(1,) } return 0; }

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

sortbooks.cpp: In function 'void merg(int, int, int)':
sortbooks.cpp:20:20: error: 'class std::vector<int>' has no member named 'pb'
   20 |             mst[x].pb(mst[z][br2]);
      |                    ^~
sortbooks.cpp:25:20: error: 'class std::vector<int>' has no member named 'pb'
   25 |             mst[x].pb(mst[y][br1]);
      |                    ^~
sortbooks.cpp:29:45: error: 'class std::vector<int>' has no member named 'pb'
   29 |         if(mst[y][br1] < mst[z][br2])mst[x].pb(mst[y][br1++]);
      |                                             ^~
sortbooks.cpp:30:21: error: 'class std::vector<int>' has no member named 'pb'
   30 |         else mst[x].pb(mst[z][br2++]);
      |                     ^~
sortbooks.cpp: In function 'void init(int, int, int)':
sortbooks.cpp:37:19: error: 'class std::vector<int>' has no member named 'pb'
   37 |         mst[node].pb(niz[l]);
      |                   ^~
sortbooks.cpp: In function 'int query(int, int, int, int, int, int)':
sortbooks.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^
sortbooks.cpp: In function 'int main()':
sortbooks.cpp:2:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    2 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
sortbooks.cpp:57:5: note: in expansion of macro 'ff'
   57 |     ff(i,1,n){
      |     ^~
sortbooks.cpp:2:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    2 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
sortbooks.cpp:61:5: note: in expansion of macro 'ff'
   61 |     ff(i,1,m){
      |     ^~
sortbooks.cpp:64:27: error: expected primary-expression before ')' token
   64 |         int sta = query(1,)
      |                           ^
sortbooks.cpp:64:13: warning: unused variable 'sta' [-Wunused-variable]
   64 |         int sta = query(1,)
      |             ^~~