| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1339558 | tuanhung0 | Airplane (NOI23_airplane) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb emplace_back
const int mod = 1e9 + 7;
const int nmax = 2e5 + 5;
int n, m, a[nmax], suf[nmax];
pair<int, int> d1[nmax], dn[nmax];
vector<int> adj[nmax];
void sub1() { // full
for (int i = n; i >= 1; --i) suf[i] = max(suf[i + 1], a[i]);
int cur = 0, ans = 0;
for (int i = 1; i < n; ++i) {
while (cur < a[i + 1] - 1) {
++cur;
++ans;
}
if (cur < suf[i + 1]) ++cur;
else if (cur > suf[i + 1]) --cur;
++ans;
}
cout << ans + cur;
}
struct node {
int dist, idx, h;
node(int _dist, int _idx, int _h) : dist(_dist), idx(_idx), h(_h) {}
bool operator < (const node &other) const {
return dist < other.dist;
}
bool operator > (const node &other) const {
return dist > other.dist;
}
};
void dijkstra(int s, int d[]) {
priority_queue<node, vector<node>, greater<node>> pq;
pq.push(node(0, s, 0));
d[s] = {0, 0};
int dis, u, cur;
while (!pq.empty()) {
node tp = pq.top();
dis = tp.dist;
u = tp.idx;
cur = tp.h;
pq.pop();
if (dis > d[u].fi || (dis == d[u].fi && cur < d[u].se)) continue;
for (int v : adj[u]) {
int newdist = dis + 1 + max(0, a[v] - cur - 1);
if (newdist < d[v].fi) {
d[v] = {newdist, max(a[v], cur + 1)};
pq.push(node(newdist, v, max(cur + 1, a[v])));
} else if (newdist == d[v] && max(cur + 1, a[v]) > d[v].se) {
d[v].se = max(cur + 1, a[v]);
pq.push(node(newdist, v, max(cur + 1, a[v])));
}
}
}
}
void sub4() {
if (n == 2) {
cout << 1;
return;
}
fill(d1 + 1, d1 + 1 + n, 1000000000);
dijkstra(1, d1);
// for (int i = 1; i <= n; ++i) cout << d1[i].fi << ' ' << d1[i].se << '\n';
fill(dn + 1, dn + 1 + n, 1000000000);
dijkstra(n, dn);
// for (int i = 1; i <= n; ++i) cout << dn[i].fi << ' ' << dn[i].se << '\n';
int ans = INT_MAX;
for (int i = 2; i < n; ++i) {
ans = min(ans, d1[i] + dn[i]);
}
cout << ans;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen("test.inp", "r")) {
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
}
cin >> n >> m;
bool checksub1 = (m == n - 1);
for (int i = 1; i <= n; ++i) cin >> a[i];
for (int i = 1; i <= m; ++i) {
int u, v; cin >> u >> v;
adj[u].pb(v);
adj[v].pb(u);
if (u != i || v != i + 1) checksub1 = 0;
}
sub4();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'void dijkstra(int, int*)':
Main.cpp:47:17: error: cannot convert '<brace-enclosed initializer list>' to 'int' in assignment
47 | d[s] = {0, 0};
| ^
Main.cpp:4:12: error: request for member 'first' in '*(d + ((sizetype)(((long unsigned int)u) * 4)))', which is of non-class type 'int'
4 | #define fi first
| ^~~~~
Main.cpp:55:24: note: in expansion of macro 'fi'
55 | if (dis > d[u].fi || (dis == d[u].fi && cur < d[u].se)) continue;
| ^~
Main.cpp:4:12: error: request for member 'first' in '*(d + ((sizetype)(((long unsigned int)u) * 4)))', which is of non-class type 'int'
4 | #define fi first
| ^~~~~
Main.cpp:55:43: note: in expansion of macro 'fi'
55 | if (dis > d[u].fi || (dis == d[u].fi && cur < d[u].se)) continue;
| ^~
Main.cpp:5:12: error: request for member 'second' in '*(d + ((sizetype)(((long unsigned int)u) * 4)))', which is of non-class type 'int'
5 | #define se second
| ^~~~~~
Main.cpp:55:60: note: in expansion of macro 'se'
55 | if (dis > d[u].fi || (dis == d[u].fi && cur < d[u].se)) continue;
| ^~
Main.cpp:4:12: error: request for member 'first' in '*(d + ((sizetype)(((long unsigned int)v) * 4)))', which is of non-class type 'int'
4 | #define fi first
| ^~~~~
Main.cpp:58:32: note: in expansion of macro 'fi'
58 | if (newdist < d[v].fi) {
| ^~
Main.cpp:59:52: error: cannot convert '<brace-enclosed initializer list>' to 'int' in assignment
59 | d[v] = {newdist, max(a[v], cur + 1)};
| ^
Main.cpp:5:12: error: request for member 'second' in '*(d + ((sizetype)(((long unsigned int)v) * 4)))', which is of non-class type 'int'
5 | #define se second
| ^~~~~~
Main.cpp:61:69: note: in expansion of macro 'se'
61 | } else if (newdist == d[v] && max(cur + 1, a[v]) > d[v].se) {
| ^~
Main.cpp:5:12: error: request for member 'second' in '*(d + ((sizetype)(((long unsigned int)v) * 4)))', which is of non-class type 'int'
5 | #define se second
| ^~~~~~
Main.cpp:62:22: note: in expansion of macro 'se'
62 | d[v].se = max(cur + 1, a[v]);
| ^~
Main.cpp: In function 'void sub4()':
Main.cpp:76:17: error: cannot convert 'std::pair<int, int>*' to 'int*'
76 | dijkstra(1, d1);
| ^~
| |
| std::pair<int, int>*
Main.cpp:44:26: note: initializing argument 2 of 'void dijkstra(int, int*)'
44 | void dijkstra(int s, int d[]) {
| ~~~~^~~
Main.cpp:79:17: error: cannot convert 'std::pair<int, int>*' to 'int*'
79 | dijkstra(n, dn);
| ^~
| |
| std::pair<int, int>*
Main.cpp:44:26: note: initializing argument 2 of 'void dijkstra(int, int*)'
44 | void dijkstra(int s, int d[]) {
| ~~~~^~~
Main.cpp:84:30: error: no match for 'operator+' (operand types are 'std::pair<int, int>' and 'std::pair<int, int>')
84 | ans = min(ans, d1[i] + dn[i]);
| ~~~~~ ^ ~~~~~
| | |
| | pair<[...],[...]>
| pair<[...],[...]>
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
from /usr/include/c++/13/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
from Main.cpp:1:
/usr/include/c++/13/bits/stl_iterator.h:634:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_IteratorL> std::operator+(typename reverse_iterator<_IteratorL>::difference_type, const reverse_iterator<_IteratorL>&)'
634 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:634:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_IteratorL>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/stl_iterator.h:1808:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1808 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1808:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
In file included from /usr/include/c++/13/string:54,
from /usr/include/c++/13/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
/usr/include/c++/13/bits/basic_string.h:3553:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3553 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3553:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3571:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3571 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3571:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: mismatched types 'const _CharT*' and 'std::pair<int, int>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3590:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3590 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3590:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3607:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3607 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3607:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3625:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3625 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3625:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3637:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3637 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3637:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3644:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3644 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3644:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3651:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3651 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3651:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3674:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3674 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3674:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: mismatched types 'const _CharT*' and 'std::pair<int, int>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3681:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3681 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3681:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3688:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3688 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3688:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/basic_string.h:3695:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3695 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3695:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
In file included from /usr/include/c++/13/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127:
/usr/include/c++/13/complex:335:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)'
335 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/13/complex:335:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::complex<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/complex:344:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)'
344 | operator+(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/13/complex:344:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::complex<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/complex:353:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const _Tp&, const complex<_Tp>&)'
353 | operator+(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/13/complex:353:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::complex<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/complex:454:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const complex<_Tp>&)'
454 | operator+(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/13/complex:454:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::complex<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
In file included from /usr/include/c++/13/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:166:
/usr/include/c++/13/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
405 | _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
405 | _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
405 | _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
405 | _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
405 | _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/valarray:1196:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__plus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__plus, _Tp>::result_type> std::operator+(const valarray<_Tp>&, const valarray<_Tp>&)'
1196 | _DEFINE_BINARY_OPERATOR(+, __plus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/valarray:1196:1: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/valarray:1196:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__plus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__plus, _Tp>::result_type> std::operator+(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1196 | _DEFINE_BINARY_OPERATOR(+, __plus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/valarray:1196:1: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/valarray:1196:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__plus, _Tp>::result_type> std::operator+(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1196 | _DEFINE_BINARY_OPERATOR(+, __plus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/valarray:1196:1: note: template argument deduction/substitution failed:
Main.cpp:84:36: note: 'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>'
84 | ans = min(ans, d1[i] + dn[i]);
| ^
/usr/include/c++/13/bits/stl_algobase.h: In instantiation of 'constexpr typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = pair<int, int>*; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/13/bits/stl_algobase.h:977:21: required from 'constexpr void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = pair<int, int>*; _Tp = int]'
/usr/include/c++/13/bits/stl_algobase.h:1007:20: required from 'constexpr void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = pair<int, int>*; _Tp = int]'
Main.cpp:75:9: required from here
/usr/include/c++/13/bits/stl_algobase.h:931:18: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and 'const int')
931 | *__first = __tmp;
| ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/bits/stl_pair.h:439:9: note: candidate: 'template<class _U1, class _U2> constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) requires _S_assignable<const _U1&, const _U2&>() [with _U2 = _U1; _T1 = int; _T2 = int]'
439 | operator=(const pair<_U1, _U2>& __p)
| ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:439:9: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_algobase.h:931:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'const int'
931 | *__first = __tmp;
| ~~~~~~~~~^~~~~~~
/usr/include/c++/13/bits/stl_pair.h:451:9: note: candidate: 'template<class _U1, class _U2> constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) requires _S_assignable<_U1, _U2>() [with _U2 = _U1; _T1 = int; _T2 = int]'
451 | operator=(pair<_U1, _U2>&& __p)
| ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:451:9: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_algobase.h:931:18: note: mismatched types 'std::pair<_T1, _T2>' and 'const int'
931 | *__first = __tmp;
| ~~~~~~~~~^~~~~~~
/usr/include/c++/13/bits/stl_pair.h:416:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_T1, _T2>&) requires _S_assignable<const _T1&, const _T2&>() [with _T1 = int; _T2 = int]'
416 | operator=(const pair& __p)
| ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:416:29: note: no known conversion for argument 1 from 'const int' to 'const std::pair<int, int>&'
416 | operator=(const pair& __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_pair.h:427:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_T1, _T2>&&) requires _S_assignable<_T1, _T2>() [with _T1 = int; _T2 = int]'
427 | operator=(pair&& __p)
| ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:427:24: note: no known conversion for argument 1 from 'const int' to 'std::pair<int, int>&&'
427 | operator=(pair&& __p)
| ~~~~~~~^~~
Main.cpp: In function 'int main()':
Main.cpp:95:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
95 | freopen("test.inp", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:96:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
96 | freopen("test.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~