| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 767678 | ono_de206 | Arranging Shoes (IOI19_shoes) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
// #define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int mxn = 1e5 + 10;
int a[mxn];
queue<pair<int, int>> q[mxn][3];
long long count_swaps(vector<int> s) {
int n = (int)s.size() * 2;
for(int i = 1; i <= n; i++) {
a[i] = s[i - 1];
}
int ret = 0;
for(int i = 1; i <= n; i++) {
if(a[i] > 0) {
if(q[a[i]][0].size()) {
int lst = q[a[i]][0].front();
q[a[i]][0].pop();
ans += (i - lst - 1) - (get(i) - get(lst));
add(i, -1);
add(lst, 1);
} else {
q[a[i]][1].push(i);
}
} else {
if(q[a[i]][1].size()) {
int lst = q[a[i]][1].front();
q[a[i]][1].pop();
ans += (i - lst) - (get(i) - get(lst));
add(i, -1);
add(lst, 1);
} else {
q[a[i]][0].push(i);
}
}
}
return ret;
}
컴파일 시 표준 에러 (stderr) 메시지
shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:34:31: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'int' in initialization
34 | int lst = q[a[i]][0].front();
| ~~~~~~~~~~~~~~~~^~
| |
| __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type {aka std::pair<int, int>}
shoes.cpp:36:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^~~
| abs
shoes.cpp:36:34: error: no matching function for call to 'get(int&)'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:223:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)'
223 | get(std::pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/10/utility:223:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:228:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)'
228 | get(std::pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/10/utility:228:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:233:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)'
233 | get(const std::pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/10/utility:233:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:238:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const std::pair<_Tp1, _Tp2>&&)'
238 | get(const std::pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/10/utility:238:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:247:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)'
247 | get(pair<_Tp, _Up>& __p) noexcept
| ^~~
/usr/include/c++/10/utility:247:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::pair<_T1, _T2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:252:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)'
252 | get(const pair<_Tp, _Up>& __p) noexcept
| ^~~
/usr/include/c++/10/utility:252:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:257:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)'
257 | get(pair<_Tp, _Up>&& __p) noexcept
| ^~~
/usr/include/c++/10/utility:257:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::pair<_T1, _T2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:262:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_T1, _T2>&&)'
262 | get(const pair<_Tp, _Up>&& __p) noexcept
| ^~~
/usr/include/c++/10/utility:262:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:267:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)'
267 | get(pair<_Up, _Tp>& __p) noexcept
| ^~~
/usr/include/c++/10/utility:267:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::pair<_Up, _Tp>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:272:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)'
272 | get(const pair<_Up, _Tp>& __p) noexcept
| ^~~
/usr/include/c++/10/utility:272:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::pair<_Up, _Tp>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:277:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)'
277 | get(pair<_Up, _Tp>&& __p) noexcept
| ^~~
/usr/include/c++/10/utility:277:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::pair<_Up, _Tp>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:282:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_Up, _Tp>&&)'
282 | get(const pair<_Up, _Tp>&& __p) noexcept
| ^~~
/usr/include/c++/10/utility:282:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::pair<_Up, _Tp>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/tuple:39,
from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/array:334:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)'
334 | get(array<_Tp, _Nm>& __arr) noexcept
| ^~~
/usr/include/c++/10/array:334:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::array<_Tp, _Nm>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/tuple:39,
from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/array:343:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)'
343 | get(array<_Tp, _Nm>&& __arr) noexcept
| ^~~
/usr/include/c++/10/array:343:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::array<_Tp, _Nm>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/tuple:39,
from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/array:351:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)'
351 | get(const array<_Tp, _Nm>& __arr) noexcept
| ^~~
/usr/include/c++/10/array:351:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::array<_Tp, _Nm>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/tuple:39,
from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/array:360:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)'
360 | get(const array<_Tp, _Nm>&& __arr) noexcept
| ^~~
/usr/include/c++/10/array:360:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::array<_Tp, _Nm>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1294:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)'
1294 | get(tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1294:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1300:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)'
1300 | get(const tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1300:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1306:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)'
1306 | get(tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1306:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1315:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const std::tuple<_Elements ...>&&)'
1315 | get(const tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1315:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1338:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)'
1338 | get(tuple<_Types...>& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1338:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1344:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)'
1344 | get(tuple<_Types...>&& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1344:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1350:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)'
1350 | get(const tuple<_Types...>& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1350:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/functional:54,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
from shoes.cpp:2:
/usr/include/c++/10/tuple:1357:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_Elements ...>&&)'
1357 | get(const tuple<_Types...>&& __t) noexcept
| ^~~
/usr/include/c++/10/tuple:1357:5: note: template argument deduction/substitution failed:
shoes.cpp:36:34: note: mismatched types 'const std::tuple<_Elements ...>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
shoes.cpp:36:45: error: no matching function for call to 'get(int&)'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
| ^
In file included from /usr/include/c++/10/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from shoes.cpp:2:
/usr/include/c++/10/utility:223:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)'
223 | get(std::pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/10/utility:223:5: note: template argument deduction/substitution failed:
shoes.cpp:36:45: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
36 | ans += (i - lst - 1) - (get(i) - get(lst));
|