| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1335834 | gelastropod | Bikeparking (EGOI24_bikeparking) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#pragma GCC optimize("O3,inline")
#include <bits/stdc++.h>
using namespace std;
#define SIZE 1000000000
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N, a, ans = 0, crnt = 0; cin >> N;
vector<int> X, Y, pX = { 0 }, pY = { 0 }, cX, cY;
for (int i = 0; i < N; i++) {
cin >> a;
X.push_back(a);
pX.push_back(a);
}
for (int i = 0; i < N; i++) {
cin >> a;
Y.push_back(a);
pY.push_back(a);
}
cX = X, cY = Y;
int idx = 0;
for (int i = 0; i < N; i++) {
while (cY[i] > cX[idx]) {
if (idx < i) ans += cX[idx];
else if (idx > i) ans -= cX[idx];
cY[i] -= cX[idx++];
}
if (idx < i) ans += cY[i];
else if (idx > i) ans -= cY[i];
cX[idx] -= cY[i];
}
for (int i = 1; i <= N; i++) pX[i] += pX[i - 1], pY[i] += pY[i - 1];
vector<int> sums(SIZE + 10, 0);
for (int i = 0; i < N; i++) {
auto iter1 = upper_bound(pY.begin(), pY.end(), pX[i]);
auto iter2 = upper_bound(pY.begin(), pY.end(), pX[i + 1]);
if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
}
for (int i = 1; i < sums.size(); i++) sums[i] += sums[i - 1];
crnt = ans;
for (int i = 0; i < sums.size(); i++) {
crnt += sums[i] - 1 - (i >= Y[0]);
ans = max(ans, crnt);
}
cout << ans << '\n';
}컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:38:68: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
from Main.cpp:2:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
Main.cpp:38:68: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed:
Main.cpp:38:68: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5795 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed:
Main.cpp:38:68: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5805 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed:
Main.cpp:38:68: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~
Main.cpp:38:101: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
Main.cpp:38:101: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed:
Main.cpp:38:101: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5795 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed:
Main.cpp:38:101: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5805 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed:
Main.cpp:38:101: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
38 | if (iter1 - pY.begin() <= i + 1 && i != 0) sums[max(0LL, pY[i] - pX[i])]++, sums[max(0LL, pY[i + 1] - pX[i])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:39:58: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
Main.cpp:39:58: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed:
Main.cpp:39:58: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5795 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed:
Main.cpp:39:58: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5805 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed:
Main.cpp:39:58: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:39:95: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
Main.cpp:39:95: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed:
Main.cpp:39:95: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5795 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed:
Main.cpp:39:95: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5805 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed:
Main.cpp:39:95: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
39 | if (iter2 - pY.begin() <= i + 1) sums[max(0LL, pY[i] - pX[i + 1])]++, sums[max(0LL, pY[i + 1] - pX[i + 1])]--;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~