제출 #92233

#제출 시각아이디문제언어결과실행 시간메모리
92233turbatPaint By Numbers (IOI16_paint)C++14
컴파일 에러
0 ms0 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; #define N 200005 int dp[N], cnt[N], n, t, ok; string st, st1, ans; void upd(int x){ while (x <= n){ cnt[x]++; x += x & -x; } } int count(int x){ int tmp = 0; while (x){ tmp += cnt[x]; x -= x & -x; } return tmp; } string solve_puzzle(string s, vector<int> c) { n = s.size(); t = c.size(); now = 0; for (int i = 0;i < n;i++){ if (t == now){ st += '_'; continue; } ok = 0; for (int j = 0;j < c[now];j++) if (s[i + j] == '_') ok = 1; if (!ok) st += 'X', now++; else st = '_'; } reverse(s.begin(), s.end()); reverse(c.begin(), c.end()); now = 0; for (int i = 0;i < n;i++){ if (t == now){ st1 += '_'; continue; } ok = 0; for (int j = 0;j < c[now];j++) if (s[i + j] == '_') ok = 1; if (!ok) st1 += 'X', now++; else st1 = '_'; } reverse(st1.begin(), st1.end()); for (int i = 0;i < n;i++) if (st[i] == st1) ans += st[i]; else ans += '?'; return ans; }

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

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:24:5: error: 'now' was not declared in this scope
     now = 0;
     ^~~
paint.cpp:24:5: note: suggested alternative: 'pow'
     now = 0;
     ^~~
     pow
paint.cpp:54:13: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' and 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}')
   if (st[i] == st1) ans += st[i];
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:940:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)
     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:940:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1013:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)
     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1013:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1093:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)
     operator==(const sub_match<_Bi_iter>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1093:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1173:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)
     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1173:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1247:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)
     operator==(const sub_match<_Bi_iter>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1247:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1321:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)
     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1321:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1401:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)
     operator==(const sub_match<_Bi_iter>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1401:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from paint.cpp:2:
/usr/include/c++/7/bits/regex.h:1920:5: note: candidate: template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const std::__cxx11::match_results<_BiIter, _Alloc>&, const std::__cxx11::match_results<_BiIter, _Alloc>&)
     operator==(const match_results<_Bi_iter, _Alloc>& __m1,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1920:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/string:40,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/stl_pair.h:443:5: note: candidate: template<class _T1, class _T2> constexpr bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_pair.h:443:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/string:40,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:299:5: note: candidate: template<class _Iterator> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator==(const reverse_iterator<_Iterator>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:299:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/string:40,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:337:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator==(const reverse_iterator<_IteratorL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:337:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/string:40,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:1118:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)
     operator==(const move_iterator<_IteratorL>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:1118:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/string:40,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:1124:5: note: candidate: template<class _Iterator> bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)
     operator==(const move_iterator<_Iterator>& __x,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:1124:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/char_traits.h:40:0,
                 from /usr/include/c++/7/string:40,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/postypes.h:216:5: note: candidate: template<class _StateT> bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&)
     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
     ^~~~~~~~
/usr/include/c++/7/bits/postypes.h:216:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/string:41:0,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/allocator.h:146:5: note: candidate: template<class _T1, class _T2> bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_T2>&)
     operator==(const allocator<_T1>&, const allocator<_T2>&)
     ^~~~~~~~
/usr/include/c++/7/bits/allocator.h:146:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::allocator<_CharT>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/string:41:0,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/allocator.h:152:5: note: candidate: template<class _Tp> bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_CharT>&)
     operator==(const allocator<_Tp>&, const allocator<_Tp>&)
     ^~~~~~~~
/usr/include/c++/7/bits/allocator.h:152:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::allocator<_CharT>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/string:52:0,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5997:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5997:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/string:52:0,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/basic_string.h:6005:5: note: candidate: template<class _CharT> typename __gnu_cxx::__enable_if<std::__is_char<_Tp>::__value, bool>::__type std::operator==(const std::__cxx11::basic_string<_CharT>&, const std::__cxx11::basic_string<_CharT>&)
     operator==(const basic_string<_CharT>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:6005:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::basic_string<_CharT>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/string:52:0,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/basic_string.h:6019:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator==(const _CharT* __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:6019:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const _CharT*' and 'char'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/string:52:0,
                 from paint.h:3,
                 from paint.cpp:1:
/usr/include/c++/7/bits/basic_string.h:6031:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:6031:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/vector:64:0,
                 from paint.h:4,
                 from paint.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:1596:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)
     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:1596:5: note:   template argument deduction/substitution failed:
paint.cpp:54:16: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}'
   if (st[i] == st1) ans += st[i];
                ^~~
In file included from /usr/include/c++/7/bits/ios_base.h:46:0,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from paint.cpp:2:
/usr/include/c++/7/system_error:292:3: note: candidate: bool std::operator==(const std::error_code&, const std::error_code&)
   operator==(const error_code& __lhs, const error_code& __rhs) noexcept
   ^~~~~~~~
/usr/include/c++/7/system_error:292:3: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' to 'const std::error_code&'
/usr/include/c++/7/system_error:297:3: note: candidate: bool std::operator==(const std::error_code&, const std::error_condition&)
   operator==(const error_code& __lhs, const error_condition& __rhs) noexcept
   ^~~~~~~~
/usr/include/c++/7/system_error:297:3: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' to 'const std::error_code&'
/usr/include/c++/7/system_error:304:3: note: candidate: bool std::operator==(const std::error_condition&, const std::error_code&)
   operator==(const error_condition& __lhs, const error_code& __rhs) noexcept
   ^~~~~~~~
/usr/include/c++/7/system_error:304:3: note:   no known conversion for argument 1 from '_