# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
421371 | 2021-06-09T05:55:43 Z | Andyvanh1 | Data Transfer (IOI19_transfer) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> #include "transfer.h" using namespace std; #define vt vector #define INF 0x3f3f3f3f #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,x) for(int (i) = 0;(i) < (x); (i)++) #define MOD 1000000007 typedef vt<int> vi; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; bool jump(int x){ cout<<x<<endl; bool ans; cin>>ans; return ans; } vi get_attachment(vi source){ vi ans(12); vi x = 0; int ct = 0; for(int i = 1; i <= 63; i++){ x^=i*(source[i-1]); if(source[i-1])ct++; } for(int i = 0; i < 6; i++){ ans[i] = ((1<<i)&x ? 1 : 0); if(ans[i])ct++; } for(int i = 0; i < 6; i++){ ans[i+6] = ((1<<i)&ct?1:0); } return ans; } vi retrieve_data(vi data){ int x = 0; vi ans1(63); vi ans2(6); vi ans3(6); for(int i = 0; i < 63; i++){ ans1[i] = data[i]; } for(int i = 63; i < 69; i++){ ans2[i-63] = data[i]; } for(int i = 69; i < 75; i++){ ans3[i-69] = data[i]; } int x = 0; int y = 0; int z = 0; int ct = 0; for(int i = 1; i <= 63; i++){ x^=i*(ans1[i-1]); if(ans1[i-1])ct++; } for(int i = 0; i < 6; i++){ y+=(1<<i)*ans2[i]; z+=(1<<i)*ans3[i]; if(ans2[i])ct++; } if(x==y)return ans1; if(ct>z){ if(x<y){ ans1[x^y-1]^=1; return ans1; }else{ return ans1; } }else{ if(x>y){ ans1[x^y-1]^=1; return ans1; }else{ return ans1; } } }
Compilation message
transfer.cpp: In function 'vi get_attachment(vi)': transfer.cpp:27:12: error: conversion from 'int' to non-scalar type 'vi' {aka 'std::vector<int>'} requested 27 | vi x = 0; | ^ transfer.cpp:30:10: error: no match for 'operator^=' (operand types are 'vi' {aka 'std::vector<int>'} and 'int') 30 | x^=i*(source[i-1]); In file included from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from transfer.cpp:1: /usr/include/c++/10/bits/ios_base.h:107:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator^=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)' 107 | operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) | ^~~~~~~~ /usr/include/c++/10/bits/ios_base.h:107:29: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::_Ios_Fmtflags&' 107 | operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/ios_base.h:149:3: note: candidate: 'const std::_Ios_Openmode& std::operator^=(std::_Ios_Openmode&, std::_Ios_Openmode)' 149 | operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) | ^~~~~~~~ /usr/include/c++/10/bits/ios_base.h:149:29: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::_Ios_Openmode&' 149 | operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/ios_base.h:189:3: note: candidate: 'const std::_Ios_Iostate& std::operator^=(std::_Ios_Iostate&, std::_Ios_Iostate)' 189 | operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) | ^~~~~~~~ /usr/include/c++/10/bits/ios_base.h:189:28: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::_Ios_Iostate&' 189 | operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) | ~~~~~~~~~~~~~~^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105, from transfer.cpp:1: /usr/include/c++/10/future:170:18: note: candidate: 'std::launch& std::operator^=(std::launch&, std::launch)' 170 | inline launch& operator^=(launch& __x, launch __y) | ^~~~~~~~ /usr/include/c++/10/future:170:37: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::launch&' 170 | inline launch& operator^=(launch& __x, launch __y) | ~~~~~~~~^~~ transfer.cpp:34:25: error: no match for 'operator&' (operand types are 'int' and 'vi' {aka 'std::vector<int>'}) 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ~~~~~~^~ | | | | int vi {aka std::vector<int>} In file included from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from transfer.cpp:1: /usr/include/c++/10/bits/ios_base.h:83:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)' 83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) | ^~~~~~~~ /usr/include/c++/10/bits/ios_base.h:83:46: note: no known conversion for argument 2 from 'vi' {aka 'std::vector<int>'} to 'std::_Ios_Fmtflags' 83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/ios_base.h:125:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)' 125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) | ^~~~~~~~ /usr/include/c++/10/bits/ios_base.h:125:46: note: no known conversion for argument 2 from 'vi' {aka 'std::vector<int>'} to 'std::_Ios_Openmode' 125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/ios_base.h:165:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(std::_Ios_Iostate, std::_Ios_Iostate)' 165 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) | ^~~~~~~~ /usr/include/c++/10/bits/ios_base.h:165:44: note: no known conversion for argument 2 from 'vi' {aka 'std::vector<int>'} to 'std::_Ios_Iostate' 165 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) | ~~~~~~~~~~~~~^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66, from transfer.cpp:1: /usr/include/c++/10/bitset:1435:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const std::bitset<_Nb>&, const std::bitset<_Nb>&)' 1435 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/10/bitset:1435:5: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: mismatched types 'const std::bitset<_Nb>' and 'int' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/c++/10/bits/shared_ptr_atomic.h:33, from /usr/include/c++/10/memory:85, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:82, from transfer.cpp:1: /usr/include/c++/10/bits/atomic_base.h:100:3: note: candidate: 'constexpr std::memory_order std::operator&(std::memory_order, std::__memory_order_modifier)' 100 | operator&(memory_order __m, __memory_order_modifier __mod) | ^~~~~~~~ /usr/include/c++/10/bits/atomic_base.h:100:55: note: no known conversion for argument 2 from 'vi' {aka 'std::vector<int>'} to 'std::__memory_order_modifier' 100 | operator&(memory_order __m, __memory_order_modifier __mod) | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/10/valarray:603, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/c++/10/valarray:603, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/c++/10/valarray:603, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/c++/10/valarray:603, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/c++/10/valarray:603, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const std::valarray<_Tp>&, const std::valarray<_Tp>&)' 1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/valarray:1191:1: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: mismatched types 'const std::valarray<_Tp>' and 'int' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)' 1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/valarray:1191:1: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: mismatched types 'const std::valarray<_Tp>' and 'int' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from transfer.cpp:1: /usr/include/c++/10/valarray:1191:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)' 1191 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/valarray:1191:1: note: template argument deduction/substitution failed: transfer.cpp:34:26: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::valarray<_Tp>' 34 | ans[i] = ((1<<i)&x ? 1 : 0); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105, from transfer.cpp:1: /usr/include/c++/10/future:143:20: note: candidate: 'constexpr std::launch std::operator&(std::launch, std::launch)' 143 | constexpr launch operator&(launch __x, launch __y) | ^~~~~~~~ /usr/include/c++/10/future:143:37: note: no known conversion for argument 1 from 'int' to 'std::launch' 143 | constexpr launch operator&(launch __x, launch __y) | ~~~~~~~^~~ transfer.cpp: In function 'vi retrieve_data(vi)': transfer.cpp:57:9: error: redeclaration of 'int x' 57 | int x = 0; | ^ transfer.cpp:44:9: note: 'int x' previously declared here 44 | int x = 0; | ^ transfer.cpp:73:21: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses] 73 | ans1[x^y-1]^=1; | ~^~ transfer.cpp:80:21: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses] 80 | ans1[x^y-1]^=1; | ~^~