제출 #1275276

#제출 시각아이디문제언어결과실행 시간메모리
1275276zuz14벽 (IOI14_wall)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define F first #define S second using namespace std; const int N=(1<<20); //sprawdzic pair<int, int> tree[2*N+7]; //lower, upper void Push(int w){ tree[2*w].F=max(tree[2*w].F, tree[w].F); tree[2*w].S=min(tree[2*w].S, tree[w].S); tree[2*w+1].F=max(tree[2*w+1].F, tree[w].F); tree[2*w+1].S=min(tree[2*w+1].S, tree[w].S); } void Update(int w, int b, int e, int l, int r, int h, bool num){ if (l>e && r<b) return; if (l>=b && r<=e){ if (num) { tree[w].F=max(tree[w].F, h); tree[w].S=max(tree[w].S, h); } else { tree[w].F=min(tree[w].F, h); tree[w].S=min(tree[w].S, h); } } Push(w); Update(2*w, b, e, l, (l+r)/2, h, num); Update(2*w+1, b, e, (l+r)/2, r, h, num); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ fill(tree, tree+2*N+1, make_pair(0, 1e9)); for (int i=0; i<k; i++) Update(1, left[i], right[i], 0, N-1, height[i], op[i]-1); for (int i=1; i<N; i++) Push(i); copy(tree+N, tree+N+n, finalHeight); }

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

In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from wall.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h: In instantiation of 'static constexpr _OI std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m(_II, _II, _OI) [with _II = std::pair<int, int>*; _OI = int*]':
/usr/include/c++/13/bits/stl_algobase.h:503:12:   required from 'constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = pair<int, int>*; _OI = int*]'
/usr/include/c++/13/bits/stl_algobase.h:533:42:   required from 'constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = pair<int, int>*; _OI = int*]'
/usr/include/c++/13/bits/stl_algobase.h:541:31:   required from 'constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = pair<int, int>*; _OI = int*]'
/usr/include/c++/13/bits/stl_algobase.h:633:7:   required from 'constexpr _OI std::copy(_II, _II, _OI) [with _II = pair<int, int>*; _OI = int*]'
wall.cpp:40:9:   required from here
/usr/include/c++/13/bits/stl_algobase.h:388:25: error: cannot convert 'std::pair<int, int>' to 'int' in assignment
  388 |               *__result = *__first;
      |               ~~~~~~~~~~^~~~~~~~~~