# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1135878 | raspy | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include <vector>
#include "messy.h"
using namespace std;
vector<int> restore_permutation(int n, int w, int r)
{
for (int dl = n; dl>=2; dl/=2)
{
for (int zc = 0; zc < n; zc+=dl)
{
str t = "";
for (int i = 0; i < n; i++) t.pb((i>=zc&&i<zc+dl ? '0' : '1'));
for (int i = zc; i < zc+dl/2; i++)
{
t[i] = '1';
add_element(t);
t[i] = '0';
}
}
}
compile_set();
vector<pair<int, int>> mj(n, {0, n-1});
for (int i = 0; i < n; i++)
{
str t = "";
for (int j = 0; j < n; j++)
t.pb((j>=mj[i].f&&i<=mj[i].s ? '0' : '1'));
t[i] = '1';
bool o = check_element(t);
if (o)
mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2};
else
mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)};
}
vector<int> rez;
for (int i = 0; i < n; i++)
rez.pb(mj[i].f);
return rez;
}
컴파일 시 표준 에러 (stderr) 메시지
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)': messy.cpp:13:25: error: 'str' was not declared in this scope; did you mean 'std'? 13 | str t = ""; | ^~~ | std messy.cpp:14:53: error: 't' was not declared in this scope 14 | for (int i = 0; i < n; i++) t.pb((i>=zc&&i<zc+dl ? '0' : '1')); | ^ messy.cpp:17:33: error: 't' was not declared in this scope 17 | t[i] = '1'; | ^ messy.cpp:27:17: error: 'str' was not declared in this scope; did you mean 'std'? 27 | str t = ""; | ^~~ | std messy.cpp:29:25: error: 't' was not declared in this scope 29 | t.pb((j>=mj[i].f&&i<=mj[i].s ? '0' : '1')); | ^ messy.cpp:29:40: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f' 29 | t.pb((j>=mj[i].f&&i<=mj[i].s ? '0' : '1')); | ^ messy.cpp:29:52: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's' 29 | t.pb((j>=mj[i].f&&i<=mj[i].s ? '0' : '1')); | ^ messy.cpp:30:17: error: 't' was not declared in this scope 30 | t[i] = '1'; | ^ messy.cpp:33:40: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f' 33 | mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2}; | ^ messy.cpp:33:50: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f' 33 | mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2}; | ^ messy.cpp:33:58: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's' 33 | mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2}; | ^ messy.cpp:33:62: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and '<brace-enclosed initializer list>') 33 | mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2}; | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from messy.cpp:1: /usr/include/c++/11/bits/stl_pair.h:418:9: note: candidate: 'template<class _U1, class _U2> constexpr typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 418 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:418:9: note: template argument deduction/substitution failed: messy.cpp:33:62: note: couldn't deduce template parameter '_U1' 33 | mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2}; | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from messy.cpp:1: /usr/include/c++/11/bits/stl_pair.h:430:9: note: candidate: 'template<class _U1, class _U2> constexpr typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 430 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:430:9: note: template argument deduction/substitution failed: messy.cpp:33:62: note: couldn't deduce template parameter '_U1' 33 | mj[i] = {mj[i].f, (mj[i].f+mj[i].s)/2}; | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from messy.cpp:1: /usr/include/c++/11/bits/stl_pair.h:390:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type = const std::pair<int, int>&]' 390 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:393:55: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::conditional<true, const std::pair<int, int>&, const std::__nonesuch&>::type' {aka 'const std::pair<int, int>&'} 390 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 391 | __and_<is_copy_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | is_copy_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | const pair&, const __nonesuch&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_pair.h:401:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type = std::pair<int, int>&&]' 401 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:404:45: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::conditional<true, std::pair<int, int>&&, std::__nonesuch&&>::type' {aka 'std::pair<int, int>&&'} 401 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 402 | __and_<is_move_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | is_move_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | pair&&, __nonesuch&&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ messy.cpp:35:41: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f' 35 | mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)}; | ^ messy.cpp:35:49: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's' 35 | mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)}; | ^ messy.cpp:35:62: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's' 35 | mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)}; | ^ messy.cpp:35:64: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and '<brace-enclosed initializer list>') 35 | mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)}; | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from messy.cpp:1: /usr/include/c++/11/bits/stl_pair.h:418:9: note: candidate: 'template<class _U1, class _U2> constexpr typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 418 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:418:9: note: template argument deduction/substitution failed: messy.cpp:35:64: note: couldn't deduce template parameter '_U1' 35 | mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)}; | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from messy.cpp:1: /usr/include/c++/11/bits/stl_pair.h:430:9: note: candidate: 'template<class _U1, class _U2> constexpr typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 430 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:430:9: note: template argument deduction/substitution failed: messy.cpp:35:64: note: couldn't deduce template parameter '_U1' 35 | mj[i] = {(mj[i].f+mj[i].s)/2, (mj[i].s)}; | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from messy.cpp:1: /usr/include/c++/11/bits/stl_pair.h:390:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type = const std::pair<int, int>&]' 390 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:393:55: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::conditional<true, const std::pair<int, int>&, const std::__nonesuch&>::type' {aka 'const std::pair<int, int>&'} 390 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 391 | __and_<is_copy_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | is_copy_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | const pair&, const __nonesuch&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_pair.h:401:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type = std::pair<int, int>&&]' 401 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/11/bits/stl_pair.h:404:45: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::conditional<true, std::pair<int, int>&&, std::__nonesuch&&>::type' {aka 'std::pair<int, int>&&'} 401 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 402 | __and_<is_move_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | is_move_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | pair&&, __nonesuch&&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ messy.cpp:39:21: error: 'class std::vector<int>' has no member named 'pb' 39 | rez.pb(mj[i].f); | ^~ messy.cpp:39:30: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f' 39 | rez.pb(mj[i].f); | ^ messy.h:1:9: warning: #pragma once in main file 1 | #pragma once | ^~~~ messy_c.h:1:9: warning: #pragma once in main file 1 | #pragma once | ^~~~