submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s382690999
p00425
C++
#include<bits/stdc++.h> using namespace std; int main() { int n; while( cin >> n, n ) { string way; int left=4, right=3, front=2, back=5, top=1, under=6; int sum = 0, temp; for(int i=0; i<n; i++) { cin >> way; if( way == "North" ) { temp = top; top = front; front = under; under = back; back = temp; } else if( way == "East" ) { temp = top; top = left; left = under; under = right; right = temp; } else if( way == "West" ) { temp = top; top = right; right = under; under = left; left = temp; } else if( way == "South" ) { temp = top; top = back; back = under; under = front; front = temp; } else if( way == "Right" ) { temp = front; front = right; right = back; back = left; left = temp; } else if( way == "Left" ) { temp = front; front = left; left = back; back = right; right = temp; } sum += top; } cout << sum+1< endl; } }
a.cc: In function 'int main()': a.cc:64:18: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 64 | cout << sum+1< endl; | ~~~~~~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:64:20: note: couldn't deduce template parameter '_Bi_iter' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:64:20: note: couldn't deduce template parameter '_Bi_iter' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 64 | cout << sum+1< endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 64 | cout << sum+1< endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 64 | cout << sum+1< endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:64:20: note: couldn't deduce template parameter '_CharT' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:64:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 64 | cout << sum+1< endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/
s777477475
p00425
C++
#include <stdio.h> #include <string.h> main(){ int n,i,sum; string say; int on,under,right,left,forward,back; int preon,preunder,preright,preleft,preforward,preback; on = 1, back = 2, right = 3, left = 4, forward = 5, under = 6; while(1){ sum = 0; scanf("%d",\n); for(i=0,i<n,i++){ preon = on, preunder = under, preleft = left, preringht = right, preforward = forward, preback = back; scanf("%s",\say); switch(say){ case "North" forward = preon, under = preforward, back = preunder, on = preback; case "South" forward = preunder, } } } return 0; }
a.cc:17:20: error: stray '\' in program 17 | scanf("%d",\n); | ^ a.cc:23:24: error: stray '\' in program 23 | scanf("%s",\say); | ^ a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:8:5: error: 'string' was not declared in this scope; did you mean 'stdin'? 8 | string say; | ^~~~~~ | stdin a.cc:19:24: error: expected ';' before ')' token 19 | for(i=0,i<n,i++){ | ^ | ; a.cc:37:5: error: expected primary-expression before '}' token 37 | } | ^ a.cc:35:10: error: expected ';' before '}' token 35 | } | ^ | ; 36 | 37 | } | ~ a.cc:37:5: error: expected primary-expression before '}' token 37 | } | ^ a.cc:35:10: error: expected ')' before '}' token 35 | } | ^ | ) 36 | 37 | } | ~ a.cc:19:12: note: to match this '(' 19 | for(i=0,i<n,i++){ | ^ a.cc:37:5: error: expected primary-expression before '}' token 37 | } | ^
s630400547
p00425
C++
#include<iostream> #include<string> using namespace std; int sai[100000][6]; int x[100000],n,sum; int main(){ while(true){ for(int i=0;i<6;i++){sai[0][i]=i+1;} string S[1000000]; sum=1; cin>>n; for(int i=0;i<n;i++){cin>>S[i];} for(int i=0;i<n;i++){ if(S[i]=='North'){ x[i+1]=0; } if(S[i]=='East'){ x[i+1]=1; } if(S[i]=='South'){ x[i+1]=2; } if(S[i]=='West'){ x[i+1]=3; } if(S[i]=='Left'){ x[i+1]=3; } if(S[i]=='Right'){ x[i+1]=3; } } for(int i=1;i<=S.size();i++){ if(x[i]==2){ sai[i][0]=sai[i-1][4]; sai[i][1]=sai[i-1][0]; sai[i][2]=sai[i-1][2]; sai[i][3]=sai[i-1][3]; sai[i][4]=sai[i-1][5]; sai[i][5]=sai[i-1][1]; } if(x[i]==3){ sai[i][0]=sai[i-1][2]; sai[i][1]=sai[i-1][1]; sai[i][2]=sai[i-1][5]; sai[i][3]=sai[i-1][0]; sai[i][4]=sai[i-1][4]; sai[i][5]=sai[i-1][3]; } if(x[i]==0){ sai[i][0]=sai[i-1][1]; sai[i][1]=sai[i-1][5]; sai[i][2]=sai[i-1][2]; sai[i][3]=sai[i-1][3]; sai[i][4]=sai[i-1][0]; sai[i][5]=sai[i-1][4]; } if(x[i]==1){ sai[i][0]=sai[i-1][3]; sai[i][1]=sai[i-1][1]; sai[i][2]=sai[i-1][0]; sai[i][3]=sai[i-1][5]; sai[i][4]=sai[i-1][4]; sai[i][5]=sai[i-1][2]; } if(x[i]==4){ sai[i][0]=sai[i-1][0]; sai[i][1]=sai[i-1][3]; sai[i][2]=sai[i-1][1]; sai[i][3]=sai[i-1][4]; sai[i][4]=sai[i-1][2]; sai[i][5]=sai[i-1][5]; } if(x[i]==5){ sai[i][0]=sai[i-1][0]; sai[i][1]=sai[i-1][2]; sai[i][2]=sai[i-1][4]; sai[i][3]=sai[i-1][1]; sai[i][4]=sai[i-1][3]; sai[i][5]=sai[i-1][5]; } sum += sai[i][0]; } cout<<sum<<endl; } return 0; }
a.cc:15:18: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 15 | if(S[i]=='North'){ | ^~~~~~~ a.cc:18:18: warning: multi-character character constant [-Wmultichar] 18 | if(S[i]=='East'){ | ^~~~~~ a.cc:21:18: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 21 | if(S[i]=='South'){ | ^~~~~~~ a.cc:24:18: warning: multi-character character constant [-Wmultichar] 24 | if(S[i]=='West'){ | ^~~~~~ a.cc:27:18: warning: multi-character character constant [-Wmultichar] 27 | if(S[i]=='Left'){ | ^~~~~~ a.cc:30:18: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 30 | if(S[i]=='Right'){ | ^~~~~~~ a.cc: In function 'int main()': a.cc:15:16: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 15 | if(S[i]=='North'){ | ~~~~^~~~~~~~~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 15 | if(S[i]=='North'){ | ^~~~~~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 15 | if(S[i]=='North'){ | ^~~~~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 15 | if(S[i]=='North'){ | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 15 | if(S[i]=='North'){ | ^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:15:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:15:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:15:18: note: mismatched types 'const _CharT*' and 'int' 15 | if(S[i]=='North'){ | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:15:18: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 15 | if(S[i]=='North'){ | ^~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:15:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 15 | if(S[i]=='North'){ | ^~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48,
s671431516
p00425
C++
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out; static InputReader ir; static void solve(){ for(;;){ int n=ir.nextInt(); if(n==0) break; int ans=1; int[] d=new int[]{1,2,4,5,3,6}; while(n-->0){ String command=ir.next(); int top=d[0]; int front=d[1]; int left=d[2]; int back=d[3]; int right=d[4]; int bottom=d[5]; if("North".equals(command)){ d[3]=top; d[0]=front; d[1]=bottom; d[5]=back; } else if("East".equals(command)){ d[4]=top; d[5]=right; d[2]=bottom; d[0]=left; } else if("West".equals(command)){ d[2]=top; d[0]=right; d[4]=bottom; d[5]=left; } else if("South".equals(command)){ d[1]=top; d[5]=front; d[3]=bottom; d[0]=back; } else if("Right".equals(command)){ d[2]=front; d[3]=left; d[4]=back; d[1]=right; } else{ d[4]=front; d[1]=left; d[2]=back; d[3]=right; } ans+=d[0]; } out.println(ans); } } public static void main(String[] args) throws Exception{ ir=new InputReader(System.in); out=new PrintWriter(System.out); solve(); out.flush(); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;} public boolean hasNextByte() { if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); }catch(IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return false; } return true; } private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;} private boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;} public boolean hasNext(){skip(); return hasNextByte();} public String next(){ if(!hasNext()) throw new NoSuchElementException(); StringBuilder sb=new StringBuilder(); int b=readByte(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.InputStream; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.IOException; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.PrintWriter; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.ArrayList; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.Arrays; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.util.Comparator; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import java.util.InputMismatchException; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: 'import' does not name a type 8 | import java.util.NoSuchElementException; | ^~~~~~ a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: 'import' does not name a type 9 | import java.math.BigInteger; | ^~~~~~ a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:11:1: error: expected unqualified-id before 'public' 11 | public class Main{ | ^~~~~~
s526606765
p00425
C++
#include <cstdio> #include <iostream> using namespace std; int main(){ int n; string operation; int sum; int current_num; while(cin >> n){ if(n==0)return 0; sum = 1; current_num = 1; int deme[] = {2,5,4,3}; for(int i = 0; i < n; i++){ cin >> operation; if (operation[0] == "North"){ int d = deme[0]; sum += deme[0]; deme[0] = 7 - current_num; deme[1] = current_num; current_num = d; } else if (operation[0] == "South"){ int d = deme[1]; sum += deme[1]; deme[0] = current_num; deme[1] = 7 - current_num; current_num = d; } else if (operation[0] == "East"){ int d = deme[2]; sum += deme[2]; deme[2] = 7 - current_num; deme[3] = current_num; current_num = d; } else if (operation[0] == "West"){ int d = deme[3]; sum += deme[3]; deme[2] = current_num; deme[3] = 7 - current_num; current_num = d; } else if (operation[0] == "Right"){ int swap_n = deme[0]; int swap_s = deme[1]; deme[0] = deme[3]; deme[1] = deme[2]; deme[2] = swap_n; deme[3] = swap_s; sum += current_num; } else if (operation[0] == "Left"){ int swap_n = deme[0]; int swap_s = deme[1]; deme[0] = deme[2]; deme[1] = deme[3]; deme[2] = swap_s; deme[3] = swap_n; sum += current_num; } } cout << sum << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | if (operation[0] == "North"){ a.cc:24:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 24 | else if (operation[0] == "South"){ a.cc:32:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 32 | else if (operation[0] == "East"){ a.cc:39:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 39 | else if (operation[0] == "West"){ a.cc:46:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 46 | else if (operation[0] == "Right"){ a.cc:55:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 55 | else if (operation[0] == "Left"){
s223055592
p00425
C++
#include <iostream> #include <string> #define rep(i,n) for (int i = 0; i < n; i++) using namespace std; void north(); void south(); void west(); void east(); void right(); void left(); int top, bot, n, s, w, e, time, total, stock; string inst; int main() { while (cin >> time, time) { top = 1; bot = 6; n = 5; s = 2; w = 4; e = 3; total = 1; //initialize rep(i, time) { cin >> inst; if (inst == "North") north(); if (inst == "South") south(); if (inst == "West") west(); if (inst == "East") east(); if (inst == "Right") right(); if (inst == "Left") left(); total += top; } cout << total << endl; } return 0; } void north() { stock = top; top = s; s = bot; bot = n; n = stock; return; } void south() { stock = top; top = n; n = bot; bot = s; s = stock; return; } void west() { stock = top; top = e; e = bot; bot = w; w = stock; return; } void east() { stock = top; top = w; w = bot; bot = e; e = stock; return; } void right() { stock = n; n = w; w = s; s = e; e = stock; return; } void left() { stock = n; n = e; e = s; s = w; w = stock; return; }
a.cc:13:27: error: 'int time' redeclared as different kind of entity 13 | int top, bot, n, s, w, e, time, total, stock; | ^~~~ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:17:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 17 | while (cin >> time, time) { | ~~~ ^~ ~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 17 | while (cin >> time, time) { | ^~~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(short int)time' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(int)time' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(long int)time' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(long long int)time' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 17 | while (cin >> time, time) { | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:17:23: error: cannot bind rvalue '(void*)time' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:17:23: e
s254112369
p00425
C++
#include<iostream> using namespace std; int main(){ int i,m; char Dice[6]; int sum; int num[6],s[6]; while(1){ sum=1; for(i=0;i<6;i++){ s[i]=i+1; } cin>>n; for(m=0;m<n;m++){ cin>>Dice; if(Dice[0]=='N'){ num[0]=s[1]; num[1]=s[5]; num[4]=s[0]; num[5]=s[4]; s[0]=num[0]; s[1]=num[1]; s[4]=num[4]; s[5]=num[5]; } else if(Dice[0]=='E'){ num[0]=s[3]; num[2]=s[0]; num[3]=s[5]; num[5]=s[2]; s[0]=num[0]; s[2]=num[2]; s[3]=num[3]; s[5]=num[5]; } else if(Dice[0]=='W'){ num[0]=s[2]; num[2]=s[5]; num[3]=s[0]; num[5]=s[3]; s[0]=num[0]; s[2]=num[2]; s[3]=num[3]; s[5]=num[5]; } else if(Dice[0]=='S'){ num[0]=s[4]; num[1]=s[0]; num[4]=s[5]; num[5]=s[1]; s[0]=num[0]; s[1]=num[1]; s[4]=num[4]; s[5]=num[5]; } else if(Dice[0]=='R'){ num[1]=s[2]; num[2]=s[4]; num[3]=s[1]; num[4]=s[3]; s[1]=num[1]; s[2]=num[2]; s[3]=num[3]; s[4]=num[4]; } else if(Dice[0]=='L'){ num[1]=s[3]; num[2]=s[1]; num[3]=s[4]; num[4]=s[2]; s[1]=num[1]; s[2]=num[2]; s[3]=num[3]; s[4]=num[4]; } sum=sum+num[0]; } cout<<sum<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:22: error: 'n' was not declared in this scope 13 | cin>>n; | ^
s453374848
p00425
C++
#include<iostream> using namespace std; int main(){ int i,m; char Dice[6]; int sum; int num[6],s[6]; while(1){ sum=1; for(i=0;i<6;i++){ s[i]=i+1; } cin>>n; for(m=0;m<n;m++){ cin>>Dice; if(Dice[0]=='N'){ num[0]=s[1]; num[1]=s[5]; num[4]=s[0]; num[5]=s[4]; s[0]=num[0]; s[1]=num[1]; s[4]=num[4]; s[5]=num[5]; } else if(Dice[0]=='E'){ num[0]=s[3]; num[2]=s[0]; num[3]=s[5]; num[5]=s[2]; s[0]=num[0]; s[2]=num[2]; s[3]=num[3]; s[5]=num[5]; } else if(Dice[0]=='W'){ num[0]=s[2]; num[2]=s[5]; num[3]=s[0]; num[5]=s[3]; s[0]=num[0]; s[2]=num[2]; s[3]=num[3]; s[5]=num[5]; } else if(Dice[0]=='S'){ num[0]=s[4]; num[1]=s[0]; num[4]=s[5]; num[5]=s[1]; s[0]=num[0]; s[1]=num[1]; s[4]=num[4]; s[5]=num[5]; } else if(Dice[0]=='R'){ num[1]=s[2]; num[2]=s[4]; num[3]=s[1]; num[4]=s[3]; s[1]=num[1]; s[2]=num[2]; s[3]=num[3]; s[4]=num[4]; } else if(Dice[0]=='L'){ num[1]=s[3]; num[2]=s[1]; num[3]=s[4]; num[4]=s[2]; s[1]=num[1]; s[2]=num[2]; s[3]=num[3]; s[4]=num[4]; } sum=sum+num[0]; } cout<<sum<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:22: error: 'n' was not declared in this scope 13 | cin>>n; | ^
s368689250
p00425
C++
#include<stdio.h> int main() { int i, j, w, h, n, l, m, cnt = 1; char str1[100] = { 0 }; int a[100]; int b[6 + 100]; int box[6 + 100]; int temp; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%s", str1[i]); } for (i = 1; i <= 6; i++) { box[i] = cnt; a[i] = cnt; cnt++; } for (i = 0; i < n; i++) { if (str1== "North") { temp += a[1]; box[1] = a[1]; box[2] = a[2]; box[5] = a[5]; box[6] = a[6]; a[2] = box[1]; a[6] = box[2]; a[5] = box[6]; a[1] = box[5]; } else if (str1 == "E") { temp += a[4]; box[1] = a[1]; box[3] = a[3]; box[4] = a[4]; box[6] = a[6]; a[4] = box[1]; a[6] = box[4]; a[3] = box[6]; a[1] = box[3]; } else if (str1 == "W") { temp += a[3]; box[1] = a[1]; box[3] = a[3]; box[4] = a[4]; box[6] = a[6]; a[1] = box[3]; a[3] = box[6]; a[6] = box[4]; a[4] = box[1]; } else { temp += a[5]; box[1] = a[1]; box[2] = a[2]; box[5] = a[5]; box[6] = a[6]; a[1] = box[5]; a[5] = box[6]; a[6] = box[2]; a[2] = box[1]; } } printf("%d\n", temp); } return 0; }
a.cc:67:1: error: expected unqualified-id before 'return' 67 | return 0; | ^~~~~~ a.cc:68:1: error: expected declaration before '}' token 68 | } | ^
s416540338
p00425
C++
#include<iostream> using namespace std; int main(){ int i,m; char Dice[6]; int sum; int num[6],s[6]; while(1){ sum=1; for(i=0;i<6;i++){ s[i]=i+1; } cin>>n; for(m=0;m<n;m++){ cin>>Dice; if(Dice[0]=='N'){ num[0]=s[1]; num[1]=s[5]; num[4]=s[0]; num[5]=s[4]; s[0]=num[0]; s[1]=num[1]; s[4]=num[4]; s[5]=num[5]; } else if(Dice[0]=='E'){ num[0]=s[3]; num[2]=s[0]; num[3]=s[5]; num[5]=s[2]; s[0]=num[0]; s[2]=num[2]; s[3]=num[3]; s[5]=num[5]; } else if(Dice[0]=='W'){ num[0]=s[2]; num[2]=s[5]; num[3]=s[0]; num[5]=s[3]; s[0]=num[0]; s[2]=num[2]; s[3]=num[3]; s[5]=num[5]; } else if(Dice[0]=='S'){ num[0]=s[4]; num[1]=s[0]; num[4]=s[5]; num[5]=s[1]; s[0]=num[0]; s[1]=num[1]; s[4]=num[4]; s[5]=num[5]; } else if(Dice[0]=='R'){ num[1]=s[2]; num[2]=s[4]; num[3]=s[1]; num[4]=s[3]; s[1]=num[1]; s[2]=num[2]; s[3]=num[3]; s[4]=num[4]; } else if(Dice[0]=='L'){ num[1]=s[3]; num[2]=s[1]; num[3]=s[4]; num[4]=s[2]; s[1]=num[1]; s[2]=num[2]; s[3]=num[3]; s[4]=num[4]; } sum=sum+num[0]; } cout<<sum<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:22: error: 'n' was not declared in this scope 13 | cin>>n; | ^
s082669974
p00425
C++
def North(dice): dice[0],dice[1] = dice[1],7-dice[0] def East(dice): dice[2],dice[0] = dice[0],7-dice[2] def West(dice): dice[0],dice[2] = dice[2],7-dice[0] def South(dice): dice[1],dice[0] = dice[0],7-dice[1] def Right(dice): dice[1],dice[2] = dice[2],7-dice[1] def Left(dice): dice[2],dice[1] = dice[1],7-dice[2] def main(): dice = [1,2,3] sum = 1 while 1: n = int(input()) if not n: break for _ in range(n): eval(input()+"(dice)") sum += dice[0] print(sum) dice = [1,2,3] sum = 1 return 0 if __name__ == "__main__": main()
a.cc:1:1: error: 'def' does not name a type 1 | def North(dice): | ^~~
s383306325
p00425
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { int a, b, c, d, e, f, g, n, sum; string s; vector<int>l; a = 1; b = 2; c = 3; d = 4; e = 5; f = 6; while (cin >> n){ sum = 1; for (int i = 0; i < n; i++) { cin >> s; if (s == "North") { g = a; a = b; b = f; f = e; e = g; } else if (s == "South") { g = a; a = e; e = f; f = b; b = g; } else if (s == "East") { g = a; a = d; d = f; f = c; c = g; } else if (s == "West") { g = a; a = c; c = f; f = d; d = g; } else if (s == "Right") { g = b; b = c; c = e; e = f; f = g; } else if (s == "Left") { g = b; b = d; d = e; e = c; c = g; } sum += a; } l.push_back(sum); } for (int i : l) { cout << l << endl; } }
a.cc: In function 'int main()': a.cc:66:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>') 66 | cout << l << endl; | ~~~~ ^~ ~ | | | | | std::vector<int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:124:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type*) [wit
s436798140
p00425
C++
#include <iostream> #include <string> using namespace std; void North(); void East(); void West(); void South(); void Right(); void Left(); int up = 1, down = 6, north = 5, south = 2, east = 3, west = 4; int ans = 1; int main(){ string s; int n; cin >> n; for (int i = 0; i < n; i++){ cin >> s; if (s == "North"){ North(); } else if (s == "East"){ East(); } else if (s == "West"){ West(); } else if (s == "South"){ South(); } else if (s == "Right") { Right(); } else if (s == "Left") { Left(); } } cout << ans << endl; } void North(){ int temp; temp = up; up = south; south = down; down = north; north = temp; ans += up } void East(){ int temp; temp = up; up = west; west = down; down = east; east = temp; ans += up } void West(){ int temp; temp = up; up = east; east = down; down = west; west = temp; ans += up } void South(){ int temp; temp = up; up = north; north = down; down = south; south = temp; ans += up } void Right(){ int temp; temp = south; south = east; east = north; north = west; west = temp; ans += up } void Left(){ int temp; temp = south; south = west; west = north; north = east; east = temp; ans += up }
a.cc: In function 'void North()': a.cc:48:14: error: expected ';' before '}' token 48 | ans += up | ^ | ; 49 | } | ~ a.cc: In function 'void East()': a.cc:58:18: error: expected ';' before '}' token 58 | ans += up | ^ | ; 59 | } | ~ a.cc: In function 'void West()': a.cc:68:18: error: expected ';' before '}' token 68 | ans += up | ^ | ; 69 | } | ~ a.cc: In function 'void South()': a.cc:78:18: error: expected ';' before '}' token 78 | ans += up | ^ | ; 79 | } | ~ a.cc: In function 'void Right()': a.cc:88:18: error: expected ';' before '}' token 88 | ans += up | ^ | ; 89 | } | ~ a.cc: In function 'void Left()': a.cc:98:18: error: expected ';' before '}' token 98 | ans += up | ^ | ; 99 | } | ~
s320147484
p00425
C++
#include <iostream> #include <string> using namespace std; int main() { int n, r; string s; vector<string> str; int top = 1; int left = 2; int front = 3; int _top, _left, _front; while (cin >> n, n != 0) { for (int i = 0; i < n; i++) { cin >> s; _top = top; _left = left; _front = front; if (s == "North") { _top = front; _front = 7 - top; } if (s == "East") { _top = 7 - left; _left = top; } if (s == "West") { _top = left; _left = 7 - top; } if (s == "South") { _top = 7 - front; _front = top; } if (s == "Right") { _left = front; front = 7 - left; } if (s == "Left") { _left = 7 - front; front = left; } top = _top; left = _left; front = _front; } cout << top << endl; } }
a.cc: In function 'int main()': a.cc:7:5: error: 'vector' was not declared in this scope 7 | vector<string> str; | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2 | #include <string> a.cc:7:18: error: expected primary-expression before '>' token 7 | vector<string> str; | ^ a.cc:7:20: error: 'str' was not declared in this scope; did you mean 'std'? 7 | vector<string> str; | ^~~ | std
s575974212
p00425
C++
/* * joi.cpp * * Created on: 2017/10/26 * Author: J00905 */ #include<iostream> #include<stdio.h> #include<math.h> #include<algorithm> #include<string.h> using namespace std; int main(){ int n=5,s=2,e=3,w=4,t=1,b=6; int n,z; int p=0; char sn[10]; while(1){ cin>>n; if(n==0){ break; } cin>>sn; for(int i=0;i<n;i++){ if(sn[0]=="N"){ z=t; t=s; s=b; b=n; n=z; p=p+t; } else if(sn[0]=="S"){ z=t; t=n; n=b; b=s; s=z; p=p+t; } else if(sn[0]=="E"){ z=t; t=w; w=b; b=e; e=z; p=p+t; } else if(sn[0]=="W"){ z=t; t=e; e=b; b=w; w=z; p=p+t; } else if(sn[0]=="R"){ z=s; s=e; e=n; n=w; w=z; p=p+t; } else if(sn[0]=="L"){ z=s; s=w; w=n; n=e; s=z; p=p+t; } } cout<<p<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:13: error: redeclaration of 'int n' 15 | int n,z; | ^ a.cc:14:13: note: 'int n' previously declared here 14 | int n=5,s=2,e=3,w=4,t=1,b=6; | ^ a.cc:25:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 25 | if(sn[0]=="N"){ | ~~~~~^~~~~ a.cc:33:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 33 | else if(sn[0]=="S"){ | ~~~~~^~~~~ a.cc:41:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 41 | else if(sn[0]=="E"){ | ~~~~~^~~~~ a.cc:49:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 49 | else if(sn[0]=="W"){ | ~~~~~^~~~~ a.cc:57:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 57 | else if(sn[0]=="R"){ | ~~~~~^~~~~ a.cc:65:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 65 | else if(sn[0]=="L"){ | ~~~~~^~~~~
s240467893
p00425
C++
#include<iostream> #include<stdio.h> #include<math.h> #include<algorithm> #include<string.h> using namespace std; int main(){ int n=5,s=2,e=3,w=4,t=1,b=6; int n,z; int p=0; char sn[10]; while(1){ cin>>n; if(n==0){ break; } cin>>sn; for(int i=0;i<n;i++){ if(sn[0]=='N'){ t=s; s=b; b=n; n=z; p=p+t; } else if(sn[0]=='S'){ z=t; t=n; n=b; b=s; s=z; p=p+t; } else if(sn[0]=='E'){ z=t; t=w; w=b; b=e; e=z; p=p+t; } else if(sn[0]=='W'){ z=t; t=e; e=b; b=w; w=z; p=p+t; } else if(sn[0]=='R'){ z=s; s=e; e=n; n=w; w=z; p=p+t; } else if(sn[0]=='L'){ z=s; s=w; w=n; n=e; s=z; p=p+t; } } cout<<p<<endl; n=5,s=2,e=3,w=4,t=1,b=6; } return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: redeclaration of 'int n' 10 | int n,z; | ^ a.cc:9:13: note: 'int n' previously declared here 9 | int n=5,s=2,e=3,w=4,t=1,b=6; | ^
s638407907
p00425
C++
<?php //?????????????????¶??????????????????????????? class Dice{ //?????¢????????¢????????´??¢?????°???????¨???????????????° private $top; private $front; private $right; //??????????????\??? public function __construct() { $this->top=1; $this->front=2; $this->right=3; return true; } //?????¢?????°?????????????????? public function backNum($num){ return 7-$num; } //?????¢?????°?????????????????? public function getTop(){ return $this->top; } //??????????????§?????????????????? public function setDiceStatus($diceRoll){ switch($diceRoll){ case"North": $tmp=$this->top; $this->top=$this->front; $front=$this->backNum($tmp); break; case"South": $tmp=$this->front; $this->front=$this->top; $this->top=$this->backNum($tmp); break; case"West": $tmp=$this->top; $this->top=$this->right; $this->right=$this->backNum($tmp); break; case"East": $tmp=$this->right; $this->right=$this->top; $this->top=$this->backNum($tmp); break; case"Right": $tmp=$this->front; $this->front=$this->right; $this->right=$this->backNum($tmp); break; case"Left": $tmp=$this->right; $this->right=$this->front; $this->right=$this->backNum($tmp); break; default: } } } //??????????????\??? $ans=1; $count=0; //?????§??§5??????????????????????????????????????? while($count<5){ //??????????????°?????????????????? $stdin=trim(fgets(STDIN)); //??????????????°???0??????break if($stdin==0){ break; } if($stdin<=10000){ $Dice=New Dice(); //??????????????°??????????????? for($i=0;$i<$stdin;$i++){ $diceRoll=trim(fgets(STDIN)); $Dice->setDiceStatus($diceRoll); //??????????????°???????????? $ans+=$Dice->getTop(); } //???????????? echo $ans.PHP_EOL; //????????? $ans=1; $Dice=null; //????????????????????°???????????? $count++; } }<?php //?????????????????¶??????????????????????????? class Dice{ //?????¢????????¢????????´??¢?????°???????¨???????????????° private $top; private $front; private $right; //??????????????\??? public function __construct() { $this->top=1; $this->front=2; $this->right=3; return true; } //?????¢?????°?????????????????? public function backNum($num){ return 7-$num; } //?????¢?????°?????????????????? public function getTop(){ return $this->top; } //??????????????§?????????????????? public function setDiceStatus($diceRoll){ switch($diceRoll){ case"North": $tmp=$this->top; $this->top=$this->front; $front=$this->backNum($tmp); break; case"South": $tmp=$this->front; $this->front=$this->top; $this->top=$this->backNum($tmp); break; case"West": $tmp=$this->top; $this->top=$this->right; $this->right=$this->backNum($tmp); break; case"East": $tmp=$this->right; $this->right=$this->top; $this->top=$this->backNum($tmp); break; case"Right": $tmp=$this->front; $this->front=$this->right; $this->right=$this->backNum($tmp); break; case"Left": $tmp=$this->right; $this->right=$this->front; $this->right=$this->backNum($tmp); break; default: } } } //??????????????\??? $ans=1; $count=0; //?????§??§5??????????????????????????????????????? while($count<5){ //??????????????°?????????????????? $stdin=trim(fgets(STDIN)); //??????????????°???0??????break if($stdin==0){ break; } if($stdin<=10000){ $Dice=New Dice(); //??????????????°??????????????? for($i=0;$i<$stdin;$i++){ $diceRoll=trim(fgets(STDIN)); $Dice->setDiceStatus($diceRoll); //??????????????°???????????? $ans+=$Dice->getTop(); } //???????????? echo $ans.PHP_EOL; //????????? $ans=1; $Dice=null; //????????????????????°???????????? $count++; } }
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <?php | ^ a.cc:61:1: error: '$ans' does not name a type 61 | $ans=1; | ^~~~ a.cc:62:1: error: '$count' does not name a type 62 | $count=0; | ^~~~~~ a.cc:64:1: error: expected unqualified-id before 'while' 64 | while($count<5){ | ^~~~~ a.cc:88:2: error: expected unqualified-id before '<' token 88 | }<?php | ^ a.cc:148:1: error: '$ans' does not name a type 148 | $ans=1; | ^~~~ a.cc:149:1: error: '$count' does not name a type 149 | $count=0; | ^~~~~~ a.cc:151:1: error: expected unqualified-id before 'while' 151 | while($count<5){ | ^~~~~
s084990306
p00425
C++
#include<iostream> #include<stdio.h> #include<math.h> #include<algorithm> #include<string.h> using namespace std; int main(){ int n=5,s=2,e=3,w=4,t=1,b=6; int y,z; int p=0; char sn[10]; while(1){ cin>>y; if(y==0){ break; } for(int i=0;i<y;i++){ cin>>sn; if(sn[0]=='N'){ z=t; t=s; s=b; b=n; n=z; p=p+t; } else if(sn[0]=='S'){ z=t; t=n; n=b; b=s; s=z; p=p+; } else if(sn[0]=='E'){ z=t; t=w; w=b; b=e; e=z; p=p+t; } else if(sn[0]=='W'){ z=t; t=e; e=b; b=w; w=z; p=p+t; } else if(sn[0]=='R'){ z=s; s=e; e=n; n=w; w=z; p=p+t; } else if(sn[0]=='L'){ z=s; s=w; w=n; n=e; s=z; p=p+t; } } cout<<p<<endl; n=5,s=2,e=3,w=4,t=1,b=6; p=0; } return 0; }
a.cc: In function 'int main()': a.cc:35:29: error: expected primary-expression before ';' token 35 | p=p+; | ^
s703126154
p00425
C++
#include<iostream> using namespace std; int main(){ int n; int me[6]; int cmp; int sum[5]; int hasi; char str[6]; sum[0]=1; sum[1]=1; sum[2]=1; sum[3]=1; sum[4]=1; sum[5]=1; for(int i=0;i<5;i++){ cin >> n; if(n==0){ hasi=i; break; } me[0]=1; me[1]=2; me[2]=3; me[3]=4; me[4]=5; me[5]=6; for(int i0=0;i0<n;i0++){ cin >> str; if(strcmp(str,"North")==0){ cmp=me[0]; me[0]=me[1]; me[1]=me[5]; me[5]=me[4]; me[4]=cmp; } else if(strcmp(str,"East")==0){ cmp=me[0]; me[0]=me[3]; me[3]=me[5]; me[5]=me[2]; me[2]=cmp; } else if(strcmp(str,"West")==0){ cmp=me[0]; me[0]=me[2]; me[2]=me[5]; me[5]=me[3]; me[3]=cmp; } else if(strcmp(str,"South")==0){ cmp=me[0]; me[0]=me[4]; me[4]=me[5]; me[5]=me[1]; me[1]=cmp; } else if(strcmp(str,"Right")==0){ cmp=me[1]; me[1]=me[2]; me[2]=me[4]; me[4]=me[3]; me[3]=cmp; } else if(strcmp(str,"Left")==0){ cmp=me[1]; me[1]=me[3]; me[3]=me[4]; me[4]=me[2]; me[2]=cmp; } sum[i]+=me[0]; } hasi=i; } for(int i=0;i<hasi;i++){ cout << sum[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:30:36: error: 'strcmp' was not declared in this scope 30 | if(strcmp(str,"North")==0){ | ^~~~~~ a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s388328334
p00425
C++
#include<iostream> using namespace std; int main(){ int n; int me[6]; int cmp; int sum[5]; int hasi; char str[6]; sum[0]=1; sum[1]=1; sum[2]=1; sum[3]=1; sum[4]=1; sum[5]=1; for(int i=0;i<5;i++){ cin >> n; if(n==0){ hasi=i; break; } me[0]=1; me[1]=2; me[2]=3; me[3]=4; me[4]=5; me[5]=6; for(int i0=0;i0<n;i0++){ cin >> str; if(strcmp(str,"North")==0){ cmp=me[0]; me[0]=me[1]; me[1]=me[5]; me[5]=me[4]; me[4]=cmp; } else if(strcmp(str,"East")==0){ cmp=me[0]; me[0]=me[3]; me[3]=me[5]; me[5]=me[2]; me[2]=cmp; } else if(strcmp(str,"West")==0){ cmp=me[0]; me[0]=me[2]; me[2]=me[5]; me[5]=me[3]; me[3]=cmp; } else if(strcmp(str,"South")==0){ cmp=me[0]; me[0]=me[4]; me[4]=me[5]; me[5]=me[1]; me[1]=cmp; } else if(strcmp(str,"Right")==0){ cmp=me[1]; me[1]=me[2]; me[2]=me[4]; me[4]=me[3]; me[3]=cmp; } else if(strcmp(str,"Left")==0){ cmp=me[1]; me[1]=me[3]; me[3]=me[4]; me[4]=me[2]; me[2]=cmp; } sum[i]+=me[0]; } hasi=i; } for(int i=0;i<hasi;i++){ cout << sum[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:30:36: error: 'strcmp' was not declared in this scope 30 | if(strcmp(str,"North")==0){ | ^~~~~~ a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s744881640
p00425
C++
#include<iostream> using namespace std; int main(){ int n; int me[6]; int cmp; int sum[5]; int hasi; char str[6]; sum[0]=1; sum[1]=1; sum[2]=1; sum[3]=1; sum[4]=1; sum[5]=1; for(int i=0;i<5;i++){ cin >> n; if(n==0){ hasi=i; break; } me[0]=1; me[1]=2; me[2]=3; me[3]=4; me[4]=5; me[5]=6; for(int i0=0;i0<n;i0++){ cin >> str; if(strcmp_s(str,"North")==0){ cmp=me[0]; me[0]=me[1]; me[1]=me[5]; me[5]=me[4]; me[4]=cmp; } else if(strcmp_s(str,"East")==0){ cmp=me[0]; me[0]=me[3]; me[3]=me[5]; me[5]=me[2]; me[2]=cmp; } else if(strcmp_s(str,"West")==0){ cmp=me[0]; me[0]=me[2]; me[2]=me[5]; me[5]=me[3]; me[3]=cmp; } else if(strcmp_s(str,"South")==0){ cmp=me[0]; me[0]=me[4]; me[4]=me[5]; me[5]=me[1]; me[1]=cmp; } else if(strcmp_s(str,"Right")==0){ cmp=me[1]; me[1]=me[2]; me[2]=me[4]; me[4]=me[3]; me[3]=cmp; } else if(strcmp_s(str,"Left")==0){ cmp=me[1]; me[1]=me[3]; me[3]=me[4]; me[4]=me[2]; me[2]=cmp; } sum[i]+=me[0]; } hasi=i; } for(int i=0;i<hasi;i++){ cout << sum[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:30:36: error: 'strcmp_s' was not declared in this scope 30 | if(strcmp_s(str,"North")==0){ | ^~~~~~~~
s341410130
p00425
C++
#include<bits/stdc++.h> using namespace std; using Int = long long; //BEGIN CUT HERE struct Dice{ int s[6]; void roll(char c){ //the view from above // N //W E // S //s[0]:top //s[1]:south //s[2]:east //s[3]:west //s[4]:north //s[5]:bottom int b; if(c=='E'){ b=s[0]; s[0]=s[3]; s[3]=s[5]; s[5]=s[2]; s[2]=b; } if(c=='W'){ b=s[0]; s[0]=s[2]; s[2]=s[5]; s[5]=s[3]; s[3]=b; } if(c=='N'){ b=s[0]; s[0]=s[1]; s[1]=s[5]; s[5]=s[4]; s[4]=b; } if(c=='S'){ b=s[0]; s[0]=s[4]; s[4]=s[5]; s[5]=s[1]; s[1]=b; } // migi neji if(c=='R'){ b=s[1]; s[1]=s[2]; s[2]=s[4]; s[4]=s[3]; s[3]=b; } if(c=='L'){ b=s[1]; s[1]=s[3]; s[3]=s[4]; s[4]=s[2]; s[2]=b; } } int top() { return s[0]; } int hash(){ int res=0; for(int i=0;i<6;i++) res=res*256+s[i]; return res; } }; vector<Dice> makeDices(Dice d){ vector<Dice> res; for(int i=0;i<6;i++){ Dice t(d); if(i==1) t.roll('N'); if(i==2) t.roll('S'); if(i==3) t.roll('S'),t.roll('S'); if(i==4) t.roll('L'); if(i==5) t.roll('R'); for(int k=0;k<4;k++){ res.push_back(t); t.roll('E'); } } return res; } //END CUT HERE signed ITP1_11_A(){ Dice d; for(int i=0;i<6;i++) cin >> d.s[i]; string s;cin >> s; for(int i=0;i<(int)s.size();i++) d.roll(s[i]); cout << d.top() << endl; return 0; } /* verified on 2018/02/09 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_A */ signed AOJ_0502(){ Int n; while(cin>>n,n){ Dice d; for(Int i=0;i<6;i++) d.s[i]=i+1; Int ans=d.top(); for(Int i=0;i<n;i++){ string s; cin>>s; d.roll(s[0]); ans+=d.top(); } cout<<ans<<endl; } return 0; } /* verified on 2018/02/09 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0502 */
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s057846234
p00425
C++
#include<iostream> #include<string> #include<windows.h> using namespace std; int dice[6] ={1, 3, 2, 6, 4, 5}; int sub[6]; int total = 0; char East[] = "East"; char West[] = "West"; char North[]= "North"; char South[]= "South"; char Right[]= "Right"; char Left[] = "Left"; void copy_arr(void){ for(int i = 0; i < 6; i++){ sub[i] = dice[i]; } } void change_dice(char s[]){ if(strcmp(East,s) == 0){ copy_arr(); dice[0] = sub[4]; dice[1] = sub[0]; // dice[2] = sub[2]; dice[3] = sub[1]; dice[4] = sub[3]; // dice[5] = sub[5]; } else if(strcmp(West,s) == 0){ copy_arr(); dice[0] = sub[1]; dice[1] = sub[3]; // dice[2] = sub[2]; dice[3] = sub[4]; dice[4] = sub[0]; // dice[5] = sub[5]; } else if(strcmp(North,s) == 0){ copy_arr(); dice[0] = sub[2]; // dice[1] = sub[1]; dice[2] = sub[3]; dice[3] = sub[5]; // dice[4] = sub[4]; dice[5] = sub[0]; } else if(strcmp(South,s) == 0){ copy_arr(); dice[0] = sub[5]; // dice[1] = sub[1]; dice[2] = sub[0]; dice[3] = sub[2]; // dice[4] = sub[4]; dice[5] = sub[3]; } else if(strcmp(Right,s) == 0){ copy_arr(); // dice[0] = sub[0]; //ツ陛渉可サツづ按つオ dice[1] = sub[5]; dice[2] = sub[1]; // dice[3] = sub[3]; dice[4] = sub[2]; dice[5] = sub[4]; } else if(strcmp(Left,s) == 0){ copy_arr(); // dice[0] = sub[0]; dice[1] = sub[2]; dice[2] = sub[4]; // dice[3] = sub[3]; dice[4] = sub[5]; dice[5] = sub[1]; } else{ cout << "ERR" << endl; } total += dice[0]; } int main() { char s[10000][6]; int n; for(;;){ cin >> n; if(n == 0){ break; } for(int i = 0; i < n; i++){ cin >> s[i]; } for(int i = 0; i < n; i++){ // cout <<i <<":"; change_dice(s[i]); // cout << endl; } cout << total+1 << endl; } }
a.cc:3:9: fatal error: windows.h: No such file or directory 3 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.
s798241203
p00425
C++
#include<iostream> #include<string> using namespace std; int dice[6] ={1, 3, 2, 6, 4, 5}; int sub[6]; int total = 0; char East[] = "East"; char West[] = "West"; char North[]= "North"; char South[]= "South"; char Right[]= "Right"; char Left[] = "Left"; void copy_arr(void){ for(int i = 0; i < 6; i++){ sub[i] = dice[i]; } } void change_dice(char s[]){ if(strcmp(East,s) == 0){ copy_arr(); dice[0] = sub[4]; dice[1] = sub[0]; // dice[2] = sub[2]; dice[3] = sub[1]; dice[4] = sub[3]; // dice[5] = sub[5]; } else if(strcmp(West,s) == 0){ copy_arr(); dice[0] = sub[1]; dice[1] = sub[3]; // dice[2] = sub[2]; dice[3] = sub[4]; dice[4] = sub[0]; // dice[5] = sub[5]; } else if(strcmp(North,s) == 0){ copy_arr(); dice[0] = sub[2]; // dice[1] = sub[1]; dice[2] = sub[3]; dice[3] = sub[5]; // dice[4] = sub[4]; dice[5] = sub[0]; } else if(strcmp(South,s) == 0){ copy_arr(); dice[0] = sub[5]; // dice[1] = sub[1]; dice[2] = sub[0]; dice[3] = sub[2]; // dice[4] = sub[4]; dice[5] = sub[3]; } else if(strcmp(Right,s) == 0){ copy_arr(); // dice[0] = sub[0]; //ツ陛渉可サツづ按つオ dice[1] = sub[5]; dice[2] = sub[1]; // dice[3] = sub[3]; dice[4] = sub[2]; dice[5] = sub[4]; } else if(strcmp(Left,s) == 0){ copy_arr(); // dice[0] = sub[0]; dice[1] = sub[2]; dice[2] = sub[4]; // dice[3] = sub[3]; dice[4] = sub[5]; dice[5] = sub[1]; } else{ cout << "ERR" << endl; } total += dice[0]; } int main() { char s[10000][6]; int n; for(;;){ cin >> n; if(n == 0){ break; } for(int i = 0; i < n; i++){ cin >> s[i]; } for(int i = 0; i < n; i++){ // cout <<i <<":"; change_dice(s[i]); // cout << endl; } cout << total+1 << endl; } }
a.cc: In function 'void change_dice(char*)': a.cc:24:12: error: 'strcmp' was not declared in this scope 24 | if(strcmp(East,s) == 0){ | ^~~~~~ a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>
s097361165
p00425
C++
#include<set> int m[3][4] = {{5,1,2,4},{1,3,1,0},{0,2,3,2}}; int main(){ for(int a,b,c,n,r,d;a=c=0,b=r=scanf("%d",&n),n;printf("%d\n",r)){ for(char s[10];n--;r+=a%3?b%3?(b+6-a)%6<3?2:5:b?3:4:a?6:1){ scanf("%s",s); d=-1; if(s[0]=='L')c+=3; if(s[0]=='R')c++; if(s[0]=='W')d=1; if(s[0]=='N')d=0; if(s[0]=='E')d=3; if(s[0]=='S')d=2; if(d!=-1) a=m[a%3][(d+c+a/3*2)%4], b=m[b%3][(d+c+b/3*2)%4]; } } }
a.cc: In function 'int main()': a.cc:4:39: error: 'scanf' was not declared in this scope 4 | for(int a,b,c,n,r,d;a=c=0,b=r=scanf("%d",&n),n;printf("%d\n",r)){ | ^~~~~ a.cc:4:56: error: 'printf' was not declared in this scope 4 | for(int a,b,c,n,r,d;a=c=0,b=r=scanf("%d",&n),n;printf("%d\n",r)){ | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include<set> +++ |+#include <cstdio> 2 | int m[3][4] = {{5,1,2,4},{1,3,1,0},{0,2,3,2}};
s451695578
p00425
C++
#include<stdio.h> int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5}; char s[99]; int main(){ s[87]=1;s[78]=4;s[69]=3;s[83]=2; for(int a,b,c,n,r,d;a=c=0,b=r=scanf("%d",&n),n;printf("%d\n",r)){ for(gets(s);n--;r+=a%3?b%3?(b+6-a)%6<3?2:5:b?3:4:a?6:1){ d=s[*gets(s)]; d?a=m[4*a+(d+c)%4],b=m[4*b+(d+c)%4]:c+=*s==76?3:1; } } }
a.cc: In function 'int main()': a.cc:7:21: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | for(gets(s);n--;r+=a%3?b%3?(b+6-a)%6<3?2:5:b?3:4:a?6:1){ | ^~~~ | getw
s254132316
p00425
C++
#include<stdio.h> int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r;char s[99];int main(){ for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1));}
a.cc: In function 'int main()': a.cc:2:170: error: expected primary-expression before ',' token 2 | int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r;char s[99];int main(){ for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1));} | ^
s796009507
p00425
C++
#include<stdio.h> int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r;char s[99];int main(){ for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;gets(s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1));}
a.cc: In function 'int main()': a.cc:2:133: error: 'gets' was not declared in this scope; did you mean 'getw'? 2 | int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r;char s[99];int main(){ for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;gets(s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1));} | ^~~~ | getw
s224386544
p00425
C++
#include<set> int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r; char s[99]; int main(){ for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)); }
a.cc: In function 'int main()': a.cc:5:46: error: 'scanf' was not declared in this scope 5 | for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)); | ^~~~~ a.cc:5:66: error: 'printf' was not declared in this scope 5 | for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)); | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include<set> +++ |+#include <cstdio> 2 | int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r;
s532259530
p00425
C++
#include<map> int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r; char s[99]; int main(){ for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)); }
a.cc: In function 'int main()': a.cc:5:46: error: 'scanf' was not declared in this scope 5 | for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)); | ^~~~~ a.cc:5:66: error: 'printf' was not declared in this scope 5 | for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);*s<60?printf(r?"%d\n":0,r),a=c=0,b=r=1:(d=s[*s],d?d=d+c&3,a=m[4*a+d],b=m[4*b+d]:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)); | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include<map> +++ |+#include <cstdio> 2 | int m[]={5,1,2,4,1,3,1,0,0,2,3,2,2,4,5,1,4,0,4,3,3,5,0,5},a,b,c,d,r;
s436761663
p00425
C++
#include<iostream> #include<string> int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}}
a.cc: In function 'int main()': a.cc:3:16: error: 'string' was not declared in this scope 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^~~~~~ a.cc:3:16: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ In file included from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:3:35: error: 'n' was not declared in this scope 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^ a.cc:3:45: error: expected ';' before 'r' 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^~ | ; a.cc:3:103: error: 'r' was not declared in this scope 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^ a.cc:3:272: error: 'dice' was not declared in this scope 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^~~~ a.cc:3:281: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:3:290: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 3 | int main(){for(string r;std::cin>>n;){string r;int a,b,c[3]={1,2,3},d,n,s=1;if(!n)break;for(std::cin>>r;n>0;n--){if(r=="North")a=1,b=0;if(r=="East")a=0,b=2;if(r=="West")a=2,b=0;if(r=="South")a=0,b=1;if(r=="Right")a=2,b=1;if(r=="Left")a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=dice[0];}cout<<s<<endl;}} | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s012155581
p00425
C++
N[]={ 6, 14, 18, 10, 2, 9, 22, 15, 1, 17, 23, 7, 3, 5, 21, 19, 0, 13, 20, 11, 4, 8, 16, 12}; E[]={13, 17, 9, 5, 8, 21, 14, 1, 16, 22, 6, 0, 4, 20, 18, 2, 12, 23, 10, 3, 11, 19, 15, 7}; R[]={ 3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10, 15, 12, 13, 14, 19, 16, 17, 18, 23, 20, 21, 22}; a=-1; d; char s[9]; main(c) { for(;c-48&&scanf("%s",s);) { if((c=*s)<60) ~a&&printf("%d\n",a), a=d=0; if(c=='N')d=N[d]; if(c=='E')d=E[d]; if(c=='W')d=E[E[E[d]]]; if(c=='S')d=N[N[N[d]]]; if(c=='R')d=R[d]; if(c=='L')d=R[R[R[d]]]; a+=d/4+1; } }
a.cc:1:1: error: 'N' does not name a type 1 | N[]={ 6, 14, 18, 10, 2, 9, 22, 15, 1, 17, 23, 7, 3, 5, 21, 19, 0, 13, 20, 11, 4, 8, 16, 12}; | ^ a.cc:2:1: error: 'E' does not name a type 2 | E[]={13, 17, 9, 5, 8, 21, 14, 1, 16, 22, 6, 0, 4, 20, 18, 2, 12, 23, 10, 3, 11, 19, 15, 7}; | ^ a.cc:3:1: error: 'R' does not name a type 3 | R[]={ 3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10, 15, 12, 13, 14, 19, 16, 17, 18, 23, 20, 21, 22}; | ^ a.cc:4:1: error: 'a' does not name a type 4 | a=-1; | ^ a.cc:5:1: error: 'd' does not name a type 5 | d; | ^ a.cc:7:5: error: expected constructor, destructor, or type conversion before '(' token 7 | main(c) | ^
s447812475
p00425
C++
a=-1,A=65,d; char *N="GKSOCNWLDFVTBRXHAJUPEMQI", *E="PHLTIDOXQAGWECSUMBKVJFNR", s[9]; main(c) { for(;c-48&&scanf("%s",s);a+=d/4+1) { (c=*s)<A?~a&&printf("%d\n",a),a=d=0:0; if(c==78)d=N[d]-A; if(c==69)d=E[d]-A; if(c==87)d=E[E[E[d]-A]-A]-A; if(c==83)d=N[N[N[d]-A]-A]-A; if(c==82)d=d&28|d%4+1&3; if(c==76)d=d&28|d%4+3&3; }}
a.cc:1:1: error: 'a' does not name a type 1 | a=-1,A=65,d; | ^ a.cc:3:4: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 3 | *N="GKSOCNWLDFVTBRXHAJUPEMQI", | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:4:4: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 4 | *E="PHLTIDOXQAGWECSUMBKVJFNR", | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: error: expected constructor, destructor, or type conversion before '(' token 6 | main(c) | ^
s024218645
p00425
C++
a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}}
a.cc:1:1: error: 'a' does not name a type 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~ a.cc: In function 'int main()': a.cc:1:35: error: 'n' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:21: error: 'scanf' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~~ a.cc:1:83: error: 'gets' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~ a.cc:1:96: error: 'a' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:100: error: 'b' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:209: error: 'd' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:244: error: 'printf' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a,b,d,n;main(){for(;scanf("%d\n",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&gets(r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}}
s203384732
p00425
C++
a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}}
a.cc:1:1: error: 'a' does not name a type 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~ a.cc: In function 'int main()': a.cc:1:33: error: 'n' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:21: error: 'scanf' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~~ a.cc:1:100: error: 'a' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:104: error: 'b' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:213: error: 'd' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^ a.cc:1:248: error: 'printf' was not declared in this scope 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a,b,d,n;main(){for(;scanf("%d",&n),n;){char r[9];int c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]=='E')a=0,b=2;if(r[0]=='W')a=2,b=0;if(r[0]=='S')a=0,b=1;if(r[0]=='R')a=2,b=1;if(r[0]=='L')a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}}
s211572914
p00425
C++
main(n){for(;scanf("%d",&n),n;){char r[9];int a,b,d,c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]==69)a=0,b=2;if(r[0]==87)a=2,b=0;if(r[0]==83)a=0,b=1;if(r[0]==82)a=2,b=1;if(r[0]==76)a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}}
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token 1 | main(n){for(;scanf("%d",&n),n;){char r[9];int a,b,d,c[3]={1,2,3},s=1;for(;n>0&&scanf("%s",r);n--){a=1,b=0;if(r[0]==69)a=0,b=2;if(r[0]==87)a=2,b=0;if(r[0]==83)a=0,b=1;if(r[0]==82)a=2,b=1;if(r[0]==76)a=1,b=2;d=c[a];c[a]=7-c[b];c[b]=d;s+=c[0];}printf("%d\n",s);}} | ^
s802862055
p00425
C++
#include <stdio.h> int T,F,R,c,a,t;char s[9]; main() { for(;c+21&&gets(s);a+=T) { c=*s-69; c<0?a&&printf("%d\n",a),a=0,T=1,F=2,R=3:0; c==9?t=T,T=F,F=7-t:0; c==14?t=F,F=T,T=7-t:0; !c?t=R,R=T,T=7-t:0; c==18?t=T,T=R,R=7-t:0; c==13?t=F,F=R,R=7-t:0; c==7?t=R,R=F,F=7-t:0; }}
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main() | ^~~~ a.cc: In function 'int main()': a.cc:5:12: error: 'gets' was not declared in this scope; did you mean 'getw'? 5 | for(;c+21&&gets(s);a+=T) | ^~~~ | getw
s047975485
p00425
C++
#import<ios> int D,d,c,a,X=448;char s[9]; int main() { for(;cin>>s;a+=D/64) c=*s-69, d=511-D, D= c-9?c-14?c?c-18?c-13?c-7? a&&printf("%d\n",a),a=0,83: D&X|d*8&56|D/8&7: D&X|D*8&56|d/8&7: D*64&X|D&56|d/64: d*64&X|D&56|D/64: d*8&X|D/8&56|D&7: D*8&X|d/8&56|D&7; }
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<ios> | ^~~~~~ a.cc: In function 'int main()': a.cc:5:6: error: 'cin' was not declared in this scope 5 | for(;cin>>s;a+=D/64) | ^~~
s567870258
p00425
C++
#import<iostream> int D,d,c,a,X=448;char s[9]; int main() { for(;cin>>s;a+=D/64) c=*s-69, d=511-D, D= c-9?c-14?c?c-18?c-13?c-7? a&&printf("%d\n",a),a=0,83: D&X|d*8&56|D/8&7: D&X|D*8&56|d/8&7: D*64&X|D&56|d/64: d*64&X|D&56|D/64: d*8&X|D/8&56|D&7: D*8&X|d/8&56|D&7; }
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<iostream> | ^~~~~~ a.cc: In function 'int main()': a.cc:5:6: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | for(;cin>>s;a+=D/64) | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~
s284089662
p00425
C++
#import<cstdio> int main(){for(int n,a,c,r,t;c=r=scanf("%d",&n),n;printf("%d\n",r))for(char d[]="123546",s[9];n--;r+=*d-48)scanf("%s",s),*s%6-4a=*s%5+*s%2*2+c&3,t=*d,*d=d[++a],d[++a-1]=d[5],d[5]=d[a%4+1],d[a%4+1]=t:c+=*s+3;}
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<cstdio> | ^~~~~~ a.cc: In function 'int main()': a.cc:2:127: error: unable to find numeric literal operator 'operator""a' 2 | int main(){for(int n,a,c,r,t;c=r=scanf("%d",&n),n;printf("%d\n",r))for(char d[]="123546",s[9];n--;r+=*d-48)scanf("%s",s),*s%6-4a=*s%5+*s%2*2+c&3,t=*d,*d=d[++a],d[++a-1]=d[5],d[5]=d[a%4+1],d[a%4+1]=t:c+=*s+3;} | ^~ a.cc:2:199: error: found ':' in nested-name-specifier, expected '::' 2 | int main(){for(int n,a,c,r,t;c=r=scanf("%d",&n),n;printf("%d\n",r))for(char d[]="123546",s[9];n--;r+=*d-48)scanf("%s",s),*s%6-4a=*s%5+*s%2*2+c&3,t=*d,*d=d[++a],d[++a-1]=d[5],d[5]=d[a%4+1],d[a%4+1]=t:c+=*s+3;} | ^ | :: a.cc:2:198: error: 't' is not a class, namespace, or enumeration 2 | int main(){for(int n,a,c,r,t;c=r=scanf("%d",&n),n;printf("%d\n",r))for(char d[]="123546",s[9];n--;r+=*d-48)scanf("%s",s),*s%6-4a=*s%5+*s%2*2+c&3,t=*d,*d=d[++a],d[++a-1]=d[5],d[5]=d[a%4+1],d[a%4+1]=t:c+=*s+3;} | ^
s528438681
p00425
C++
r,m,y,s;mov(int*a,int*b){r=*a,*a=*b,*b=7-r;} main(t,c){s=!scanf("%d",&c),c?:exit(0);for(m=2,y=3;c--;s+=t)scanf("%s",&r), r%=8,r-2?r-3?r-4?r-5?r-6?r-7?:mov(&t,&y):mov(&t,&m):mov(&y,&t):mov(&y,&m):mov(&m,&t):mov(&m,&y); main(1,printf("%d\n",s+1));}
a.cc:1:1: error: 'r' does not name a type 1 | r,m,y,s;mov(int*a,int*b){r=*a,*a=*b,*b=7-r;} | ^ a.cc:1:9: error: ISO C++ forbids declaration of 'mov' with no type [-fpermissive] 1 | r,m,y,s;mov(int*a,int*b){r=*a,*a=*b,*b=7-r;} | ^~~ a.cc: In function 'int mov(int*, int*)': a.cc:1:26: error: 'r' was not declared in this scope 1 | r,m,y,s;mov(int*a,int*b){r=*a,*a=*b,*b=7-r;} | ^ a.cc:1:44: warning: no return statement in function returning non-void [-Wreturn-type] 1 | r,m,y,s;mov(int*a,int*b){r=*a,*a=*b,*b=7-r;} | ^ a.cc: At global scope: a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token 2 | main(t,c){s=!scanf("%d",&c),c?:exit(0);for(m=2,y=3;c--;s+=t)scanf("%s",&r), | ^
s702789899
p00425
C++
#include <stdio.h> #include <stdlib.h> int main(void) { int top=1,front=2,right=3,n=0,sum=1,swap,; char opr; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%s",&opr); switch (opr){ case 'N': swap=top; top=front; front=(7-swap); break; case 'E': swap=right; right=top; top=(7-swap); break; case 'W': swap=top; top=right; right=(7-swap); break; case 'S': swap=front; front=top; top=(7-swap); break; case 'R': swap=front; front=right; right=(7-swap); break; case 'L': swap=right; right=front; front=(7-swap); break; } sum+=top; } printf("%d",sum); return EXIT_SUCCESS; }
a.cc: In function 'int main()': a.cc:6:50: error: expected unqualified-id before ';' token 6 | int top=1,front=2,right=3,n=0,sum=1,swap,; | ^
s770991648
p00425
C++
#include <stdio.h> #include <stdlib.h> int main() { int top=1,front=2,right=3,n=0,sum=1,swap,; char opr[10]; scanf("%d",&n); for(int i=0;i<n;i++){ for (int j=0;j<5;j++) scanf("%s",&opr[j]); switch (opr[0]){ case 'N': swap=top; top=front; front=(7-swap); break; case 'E': swap=right; right=top; top=(7-swap); break; case 'W': swap=top; top=right; right=(7-swap); break; case 'S': swap=front; front=top; top=(7-swap); break; case 'R': swap=front; front=right; right=(7-swap); break; case 'L': swap=right; right=front; front=(7-swap); break; } sum+=top; } printf("%d",sum); return EXIT_SUCCESS; }
a.cc: In function 'int main()': a.cc:6:50: error: expected unqualified-id before ';' token 6 | int top=1,front=2,right=3,n=0,sum=1,swap,; | ^
s525718127
p00425
C++
#include <iostream> #include <string> using namespace std; struct{ char s[10]; int d[6]; } map[6]={ {"North",{1,5,2,0,4,3}}, {"East" ,{2,1,5,3,0,4}}, {"West" ,{4,1,0,3,5,2}}, {"South",{3,0,2,5,4,1}}, {"Right",{0,2,3,4,1,5}}, {"Left" ,{0,4,1,2,3,5}} }; int main(){ int n; for(;cin>>n,n;){ string s; int i,j,dice[6]={1,5,3,2,4,6},t[6],sum=1; for(;n--;){ cin>>s; memcpy(t,dice,sizeof(t)); for(i=0;i<6;i++) if(s==map[i].s) for(j=0;j<6;j++) dice[map[i].d[j]]=t[j]; sum+=dice[0]; } cout << sum << endl; } }
a.cc: In function 'int main()': a.cc:24:25: error: 'memcpy' was not declared in this scope 24 | memcpy(t,dice,sizeof(t)); | ^~~~~~ a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #include <string>
s500298875
p00425
C++
#include<cstdio> #include<string> #include<iostream> using namespace std; int main(){ int n; string str; while(true){ for(int i = 0; i < 3; i++){ dice[i] = i + 1; } scanf("%d", &n); if( n == 0){ break;} // 初期値 int count = 1; int temp; for(int i = 0; i < n; i++){ cin >> str; temp = dice[0]; if(str == "North"){ dice[0] = dice[1]; dice[1] = 7 - temp; } else if(str == "East"){ dice[0] = 7 -dice[2]; dice[2] = temp; } else if(str == "West"){ dice[0] = dice[2]; dice[2] = 7 - temp; } else if(str == "South"){ dice[0] = 7 - dice[1]; dice[1] = temp; } else if(str == "Right"){ temp = dice[1]; dice[1] = dice[2]; dice[2] = 7 - dice[1]; } else if(str == "Left"){ temp = dice[1]; dice[1] = 7 - dice[2]; dice[2] = temp; } count += dice[0]; } printf("%d\n", count); } return 0; }
a.cc: In function 'int main()': a.cc:12:25: error: 'dice' was not declared in this scope 12 | dice[i] = i + 1; | ^~~~ a.cc:23:32: error: 'dice' was not declared in this scope 23 | temp = dice[0]; | ^~~~
s555459898
p00425
C++
#include <iostream> #include <string> using namespace std; class Dice { private : void Swap( int &a, int &b ) { int t = a; a = b; b = t; } public : union { struct _X { int back, front; int left, right; int bottom, top; } X; struct _Y { int top, bottom; int front, back; int left, right; } Y; struct _Z { int back, front; int top, bottom; int left, right; } Z; int d[6]; }; Dice ( int t, int bt, int f, int bk, int l, int r ) { Y.top = t; Y.bottom = bt; Y.front = f; Y.back = bk; Y.left = l; Y.right = r; } void RotLeftX ( int n ); void RotLeftY ( int n ); void RotLeftZ ( int n ); void RotRightX ( int n ); void RotRightY ( int n ); void RotRightZ ( int n ); }; void Dice::RotLeftX ( int n ) { int m[] = { 2, 1, 3 }; // f, bt, bk for(int i=0; i < n; ++i) { for(int j=0; j < 3; ++j) Swap(d[0], d[m[j]]); // t } } void Dice::RotLeftY ( int n ) { int m[] = { 2, 5, 3 }; // f, r, bk for(int i=0; i < n; ++i) { for(int j=0; j < 3; ++j) Swap(d[4], d[m[j]]); // l } } void Dice::RotLeftZ ( int n ) { int m[] = { 5, 0, 4 }; // r, t, l for(int i=0; i < n; ++i) { for(int j=0; j < 3; ++j) Swap(d[1], d[m[j]]); // bt } } void Dice::RotRightX ( int n ) { int m[] = { 3, 1, 2 }; // bk, bt, f for(int i=0; i < n; ++i) { for(int j=0; j < 3; ++j) Swap(d[0], d[m[j]]); // t } } void Dice::RotRightY ( int n ) { int m[] = { 3, 5, 2 }; // bk, r, f for(int i=0; i < n; ++i) { for(int j=0; j < 3; ++j) Swap(d[4], d[m[j]]); // l } } void Dice::RotRightZ ( int n ) { int m[] = { 4, 0, 5 }; // l, t, r for(int i=0; i < n; ++i) { for(int j=0; j < 3; ++j) Swap(d[1], d[m[j]]); // bt } } int main( void ) { int n; while(cin >> n, n) { string in; Dice dice(1, 6, 2, 5, 4, 3); int sum = 1; for(int i=0; i < n; ++i) { cin >> in; switch(in[0]) { case 'N': dice.RotRightX(1); break; case 'E': dice.RotRightZ(1); break; case 'W': dice.RotLeftZ(1); break; case 'S': dice.RotLeftX(1); break; case 'R': dice.RotRightY(1); break; case 'L': dice.RotLeftY(1); break; } sum += dice.Y.top; } cout << sum << endl; } return 0; }
a.cc:11:24: error: 'struct Dice::<unnamed union>::_X' invalid; an anonymous union may only have public non-static data members [-fpermissive] 11 | struct _X { | ^~ a.cc:16:24: error: 'struct Dice::<unnamed union>::_Y' invalid; an anonymous union may only have public non-static data members [-fpermissive] 16 | struct _Y { | ^~ a.cc:21:24: error: 'struct Dice::<unnamed union>::_Z' invalid; an anonymous union may only have public non-static data members [-fpermissive] 21 | struct _Z { | ^~
s547231057
p00425
C++
#include<iostream> #include<string> using namespace std; int main(){ int n; string f[6]={"North","East","West","South","Right","Left"}; int cf[6][3]={{1,5,2},{4,1,0},{2,1,5},{3,0,2},{0,2,3},{0,4,1}}; int sum=1; int a=0; int me[6]={1,2,3,5,4,6}; int ne[3]; cin>>n: for(int i=0;i<n;i++){ cin>>s; for(int j=0;j<6;j++){ if(s==f[j]){ for(int k=0;k<3;k++){ ne[k]=me[cf[j][k]];} for(int k=0;k<3;k++){ me[k]=ne[k];} me[3]=7-me[1]; me[4]=7-me[2]; me[5]=7-me[0]; break; }} sum+=me[0];} cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:13:7: error: expected ';' before ':' token 13 | cin>>n: | ^ | ; a.cc:14:13: error: 'i' was not declared in this scope 14 | for(int i=0;i<n;i++){ | ^
s738244120
p00425
C++
#include <iostream> #include <string> using namespace std; int main(){ string a; int n; int b;//上面 int c;//前面 int d;//右面 int e; int f; while(cin>>n){ if(n!=0){ b=1; c=2; d=3; e=0; while(e<n){ cin>>a; if(a=="North"){f=c; c=7-b; b=f;} if(a=="East"){f=b; b=7-d; d=f;} if(a=="West"){f=d; d=7-b; b=f;} if(a=="South"){f=b; b=7-c; c=f;} if(a=="Right"){f=d; d=7-c; c=f;} if(a=="Left"){f=c; c=7-d; d=f;} e=e+1;} cout << b << endl; } }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s202481851
p00425
C++
#include <cstdio> char opr[10]; int dice(int n){ scanf("%d",&n); if(n==0) return 0; int top=1,front=2,right=3,n=0,sum=1,swap; for(int i=0;i<n;i++){ scanf("%s",opr); switch (opr[0]){ case 'N': swap=top; top=front; front=(7-swap); break; case 'E': swap=right; right=top; top=(7-swap); break; case 'W': swap=top; top=right; right=(7-swap); break; case 'S': swap=front; front=top; top=(7-swap); break; case 'R': swap=front; front=right; right=(7-swap); break; case 'L': swap=right; right=front; front=(7-swap); break; } sum+=top; } printf("%d\n",sum); } int main() { while(n==0) dice(n); return 0; }
a.cc: In function 'int dice(int)': a.cc:8:35: error: declaration of 'int n' shadows a parameter 8 | int top=1,front=2,right=3,n=0,sum=1,swap; | ^ a.cc:5:14: note: 'int n' previously declared here 5 | int dice(int n){ | ~~~~^ a.cc: In function 'int main()': a.cc:51:15: error: 'n' was not declared in this scope 51 | while(n==0) dice(n); | ^ a.cc: In function 'int dice(int)': a.cc:47:15: warning: control reaches end of non-void function [-Wreturn-type] 47 | printf("%d\n",sum); | ~~~~~~^~~~~~~~~~~~
s686716795
p00425
C++
#include <cstdio> int n; char opr[10]; int dice(int n){ scanf("%d",&n); if(n==0) return 0; int top=1,front=2,right=3,n=0,sum=1,swap; for(int i=0;i<n;i++){ scanf("%s",opr); switch (opr[0]){ case 'N': swap=top; top=front; front=(7-swap); break; case 'E': swap=right; right=top; top=(7-swap); break; case 'W': swap=top; top=right; right=(7-swap); break; case 'S': swap=front; front=top; top=(7-swap); break; case 'R': swap=front; front=right; right=(7-swap); break; case 'L': swap=right; right=front; front=(7-swap); break; } sum+=top; } printf("%d\n",sum); } int main() { while( n==0) dice(n); return 0; }
a.cc: In function 'int dice(int)': a.cc:8:35: error: declaration of 'int n' shadows a parameter 8 | int top=1,front=2,right=3,n=0,sum=1,swap; | ^ a.cc:5:14: note: 'int n' previously declared here 5 | int dice(int n){ | ~~~~^ a.cc:47:15: warning: control reaches end of non-void function [-Wreturn-type] 47 | printf("%d\n",sum); | ~~~~~~^~~~~~~~~~~~
s841013087
p00425
C++
#include <iostream> #include <queue> #include <string> #include <map> using namespace std; typedef pair<int,int> mypair; int main() { int H,W,N,c; char cmap[1002][1002]; queue<mypair> que; map<char,mypair>::iterator it; map<char,mypair> gole; mypair temp,start; while(cin >> H >> W >> N && H || W || N){ for(int i = 0; i <= W+1; i++){ cmap[0][i] = 'X'; cmap[H+1][i] = 'X'; } for(int i = 0; i <= H+1; i++){ cmap[i][0] = 'X'; cmap[i][W+1] = 'X'; } for(int i = 1; i <= H; i++){ for(int j = 1; j <= W; j++){ cin >> cmap[i][j]; if(cmap[i][j] >= '1' && cmap[i][j] <= '9'){ temp.first = i; temp.second = j; gole.insert(make_pair(cmap[i][j],temp)); } else if(cmap[i][j] == 'S'){ start.first = i; start.second = j; } } } gole.insert('0',start); for(it = gole.begin(); it != gole.end(); it++){ que.push(it->second); while(!que.empty()){ } } } return 0; }
a.cc: In function 'int main()': a.cc:43:28: error: no matching function for call to 'std::map<char, std::pair<int, int> >::insert(char, mypair&)' 43 | gole.insert('0',start); | ~~~~~~~~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/map:63, from a.cc:4: /usr/include/c++/14/bits/stl_map.h:847:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value), std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> > std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >]' 847 | insert(_Pair&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:847:9: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_map.h:924:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value), typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, _Pair&&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >]' 924 | insert(const_iterator __position, _Pair&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:924:9: note: template argument deduction/substitution failed: a.cc:43:29: note: cannot convert ''0'' (type 'char') to type 'std::map<char, std::pair<int, int> >::const_iterator' {aka 'std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::const_iterator'} 43 | gole.insert('0',start); | ^~~ /usr/include/c++/14/bits/stl_map.h:942:9: note: candidate: 'template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >]' 942 | insert(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:942:9: note: template argument deduction/substitution failed: a.cc:43:28: note: deduced conflicting types for parameter '_InputIterator' ('char' and 'std::pair<int, int>') 43 | gole.insert('0',start); | ~~~~~~~~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_map.h:661:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type std::map<_Key, _Tp, _Compare, _Alloc>::insert(node_type&&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >; insert_return_type = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::insert_return_type; node_type = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::node_type]' 661 | insert(node_type&& __nh) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:661:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_map.h:666:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, node_type&&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >; iterator = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::iterator; const_iterator = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::const_iterator; node_type = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::node_type]' 666 | insert(const_iterator __hint, node_type&& __nh) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:666:29: note: no known conversion for argument 1 from 'char' to 'std::map<char, std::pair<int, int> >::const_iterator' {aka 'std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::const_iterator'} 666 | insert(const_iterator __hint, node_type&& __nh) | ~~~~~~~~~~~~~~~^~~~~~ /usr/include/c++/14/bits/stl_map.h:834:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other = std::allocator<std::pair<const char, std::pair<int, int> > >; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const char, std::pair<int, int> > >, std::pair<const char, std::pair<int, int> > >::rebind<std::pair<const char, std::pair<int, int> > >; typename _Allocator::value_type = std::pair<const char, std::pair<int, int> >; value_type = std::pair<const char, std::pair<int, int> >]' 834 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:834:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_map.h:841:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(value_type&&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other = std::allocator<std::pair<const char, std::pair<int, int> > >; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const char, std::pair<int, int> > >, std::pair<const char, std::pair<int, int> > >::rebind<std::pair<const char, std::pair<int, int> > >; typename _Allocator::value_type = std::pair<const char, std::pair<int, int> >; value_type = std::pair<const char, std::pair<int, int> >]' 841 | insert(value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:841:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_map.h:879:7: note: candidate: 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >]' 879 | insert(std::initializer_list<value_type> __list) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:879:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_map.h:909:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = char; _Tp = std::pair<int, int>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::pair<int, int> > >; iterator = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::iterator; const_iterator = std::_Rb_tree<char, std::pair<const char, std::pair<int, int> >, std::_Select1st<std::pair<const char, std::pair<int, int> > >, std::less<char>, std::allocator<std::pair<const char, std::pair<int, int> > > >::const_iterator; value_type = std::pair<const char, std::pai
s167263075
p00425
C++
100 West North North Right Left Right South Right East Left North Right West North East East East North East Right West Left West West West West West Right West East East South West South East North East West Left South North Right Right South Right North West Left North Right North East Left East West East East Right South North Left East North Left East West North West Left Right West Left West East Right South West Right Right Left North Left East North North Left Left South East West Right Right South East East Left South East Left West
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 100 | ^~~
s170103579
p00425
C++
#include<iostream> #include<string> using namespace std; int North(int *p){ int mem; mem = p[1]; p[1] = p[2]; p[2] = p[6]; p[6] = p[5]; p[5] = mem; return p[1]; } int East(int *p){ int mem; mem = p[1]; p[1] = p[4]; p[4] = p[6]; p[6] = p[3]; p[3] = mem; return p[1]; } int West(int *p){ int mem; mem = p[1]; p[1] = p[3]; p[3] = p[6]; p[6] = p[4]; p[4] = mem; return p[1]; } int South(int *p){ int mem; mem = p[1]; p[1] = p[5]; p[5] = p[6]; p[6] = p[2]; p[2] = mem; return p[1]; } int Right(int *p){ int mem; mem = p[2]; p[2] = p[3]; p[3] = p[5]; p[5] = p[4]; p[4] = mem; return p[1]; } int Left(int *p){ int mem; mem = p[2]; p[2] = p[4]; p[4] = p[5]; p[5] = p[3]; p[3] = mem; return p[1]; } int main(){ int n,p[7];; string com; while(cin >> n){ if(n==0) break; int s = 1; for(int i=0;i<=6;i++) p[i] = i; for(int i=0;i<n;i++){ cin >> com; if(com=="North") s += North(p); else if(com=="East") s += East(p); else if(com=="West") s += West(p); else if(com=="South") s += South(p); else if(com=="Right") s += Right(p); else s += Left(); } cout << s << endl; } return 0; }
a.cc: In function 'int main()': a.cc:72:21: error: too few arguments to function 'int Left(int*)' 72 | else s += Left(); | ~~~~^~ a.cc:49:5: note: declared here 49 | int Left(int *p){ | ^~~~
s485178139
p00426
Java
import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.util.Scanner; import java.math.BigInteger; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static final long LINF=Long.MAX_VALUE/2; static int n,m,a,b,c; static Deque<Integer> queA,queB,queC; public static void main(String[] args) throws IOException{ InputReader ir=new InputReader(in); while(true){ n=ir.nextInt(); m=ir.nextInt(); if(n==0&&m==0) break; queA=new ArrayDeque<Integer>(); queB=new ArrayDeque<Integer>(); queC=new ArrayDeque<Integer>(); a=ir.nextInt(); for(int i=0;i<a;i++) queA.offerFirst(ir.nextInt()); b=ir.nextInt(); for(int i=0;i<b;i++) queB.offerFirst(ir.nextInt()); c=ir.nextInt(); for(int i=0;i<c;i++) queC.offerFirst(ir.nextInt()); int ans=dfs(0); out.println(ans>m?-1:ans); } out.flush(); } public static int dfs(int depth){ if(depth>m) return depth; if(queA.size()==n||queC.size==n) return depth; int s,t,u,v; if(!queA.isEmpty()&&(queB.isEmpty()||queA.peekFirst()>queB.peekFirst())){ int temp=queA.pollFirst(); queB.offerFirst(temp); s=dfs(depth+1); queB.pollFirst(); queA.offerFirst(temp); } if(!queC.isEmpty()&&(queB.isEmpty()||queC.peekFirst()>queB.peekFirst())){ int temp=queC.pollFirst(); queB.offerFirst(temp); t=dfs(depth+1); queB.pollFirst(); queC.offerFirst(temp); } if(!queB.isEmpty()&&(queA.isEmpty()||queB.peekFirst()>queA.peekFirst())){ int temp=queB.pollFirst(); queA.offerFirst(temp); int u=dfs(depth+1); queA.pollFirst(temp); queB.offerFirst(temp); } if(!queB.isEmpty()&&(queC.isEmpty()||queB.peekFirst()>queC.peekFirst())){ int temp=queB.pollFirst(); queC.offerFirst(temp); int v=dfs(depth+1); queC.pollFirst(temp); queB.offerFirst(temp); } return Math.min(Math.min(s,t),Math.min(u,v)); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in;} public int readByte() { if(lenbuf==-1) throw new InputMismatchException(); if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return -1; } return buffer[curbuf++]; } public boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;} public String next() { int b=skip(); StringBuilder sb=new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public int[] toIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } } }
Main.java:49: error: cannot find symbol if(queA.size()==n||queC.size==n) return depth; ^ symbol: variable size location: variable queC of type Deque<Integer> Main.java:68: error: variable u is already defined in method dfs(int) int u=dfs(depth+1); ^ Main.java:69: error: method pollFirst in interface Deque<E> cannot be applied to given types; queA.pollFirst(temp); ^ required: no arguments found: int reason: actual and formal argument lists differ in length where E is a type-variable: E extends Object declared in interface Deque Main.java:75: error: variable v is already defined in method dfs(int) int v=dfs(depth+1); ^ Main.java:76: error: method pollFirst in interface Deque<E> cannot be applied to given types; queC.pollFirst(temp); ^ required: no arguments found: int reason: actual and formal argument lists differ in length where E is a type-variable: E extends Object declared in interface Deque 5 errors
s658579181
p00426
Java
import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.util.Scanner; import java.math.BigInteger; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static final long LINF=Long.MAX_VALUE/2; static int n,m,a,b,c; static Deque<Integer> queA,queB,queC; public static void main(String[] args) throws IOException{ InputReader ir=new InputReader(in); while(true){ n=ir.nextInt(); m=ir.nextInt(); if(n==0&&m==0) break; queA=new ArrayDeque<Integer>(); queB=new ArrayDeque<Integer>(); queC=new ArrayDeque<Integer>(); a=ir.nextInt(); for(int i=0;i<a;i++) queA.offerFirst(ir.nextInt()); b=ir.nextInt(); for(int i=0;i<b;i++) queB.offerFirst(ir.nextInt()); c=ir.nextInt(); for(int i=0;i<c;i++) queC.offerFirst(ir.nextInt()); int ans=dfs(0); out.println(ans>m?-1:ans); } out.flush(); } public static int dfs(int depth){ if(depth>m) return depth; if(queA.size()==n||queC.size()==n) return depth; int s,t,u,v; if(!queA.isEmpty()&&(queB.isEmpty()||queA.peekFirst()>queB.peekFirst())){ int temp=queA.pollFirst(); queB.offerFirst(temp); s=dfs(depth+1); queB.pollFirst(); queA.offerFirst(temp); } if(!queC.isEmpty()&&(queB.isEmpty()||queC.peekFirst()>queB.peekFirst())){ int temp=queC.pollFirst(); queB.offerFirst(temp); t=dfs(depth+1); queB.pollFirst(); queC.offerFirst(temp); } if(!queB.isEmpty()&&(queA.isEmpty()||queB.peekFirst()>queA.peekFirst())){ int temp=queB.pollFirst(); queA.offerFirst(temp); u=dfs(depth+1); queA.pollFirst(temp); queB.offerFirst(temp); } if(!queB.isEmpty()&&(queC.isEmpty()||queB.peekFirst()>queC.peekFirst())){ int temp=queB.pollFirst(); queC.offerFirst(temp); v=dfs(depth+1); queC.pollFirst(temp); queB.offerFirst(temp); } return Math.min(Math.min(s,t),Math.min(u,v)); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in;} public int readByte() { if(lenbuf==-1) throw new InputMismatchException(); if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return -1; } return buffer[curbuf++]; } public boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;} public String next() { int b=skip(); StringBuilder sb=new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public int[] toIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } } }
Main.java:69: error: method pollFirst in interface Deque<E> cannot be applied to given types; queA.pollFirst(temp); ^ required: no arguments found: int reason: actual and formal argument lists differ in length where E is a type-variable: E extends Object declared in interface Deque Main.java:76: error: method pollFirst in interface Deque<E> cannot be applied to given types; queC.pollFirst(temp); ^ required: no arguments found: int reason: actual and formal argument lists differ in length where E is a type-variable: E extends Object declared in interface Deque 2 errors
s364382730
p00426
Java
import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.util.Scanner; import java.math.BigInteger; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static final long LINF=Long.MAX_VALUE/2; static int n,m,a,b,c; static Deque<Integer> queA,queB,queC; public static void main(String[] args) throws IOException{ InputReader ir=new InputReader(in); while(true){ n=ir.nextInt(); m=ir.nextInt(); if(n==0&&m==0) break; queA=new ArrayDeque<Integer>(); queB=new ArrayDeque<Integer>(); queC=new ArrayDeque<Integer>(); a=ir.nextInt(); for(int i=0;i<a;i++) queA.offerFirst(ir.nextInt()); b=ir.nextInt(); for(int i=0;i<b;i++) queB.offerFirst(ir.nextInt()); c=ir.nextInt(); for(int i=0;i<c;i++) queC.offerFirst(ir.nextInt()); int ans=dfs(0); out.println(ans>m?-1:ans); } out.flush(); } public static int dfs(int depth){ if(depth>m) return depth; if(queA.size()==n||queC.size()==n) return depth; int s,t,u,v; if(!queA.isEmpty()&&(queB.isEmpty()||queA.peekFirst()>queB.peekFirst())){ int temp=queA.pollFirst(); queB.offerFirst(temp); s=dfs(depth+1); queB.pollFirst(); queA.offerFirst(temp); } if(!queC.isEmpty()&&(queB.isEmpty()||queC.peekFirst()>queB.peekFirst())){ int temp=queC.pollFirst(); queB.offerFirst(temp); t=dfs(depth+1); queB.pollFirst(); queC.offerFirst(temp); } if(!queB.isEmpty()&&(queA.isEmpty()||queB.peekFirst()>queA.peekFirst())){ int temp=queB.pollFirst(); queA.offerFirst(temp); u=dfs(depth+1); queA.pollFirst(); queB.offerFirst(temp); } if(!queB.isEmpty()&&(queC.isEmpty()||queB.peekFirst()>queC.peekFirst())){ int temp=queB.pollFirst(); queC.offerFirst(temp); v=dfs(depth+1); queC.pollFirst(); queB.offerFirst(temp); } return Math.min(Math.min(s,t),Math.min(u,v)); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in;} public int readByte() { if(lenbuf==-1) throw new InputMismatchException(); if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return -1; } return buffer[curbuf++]; } public boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;} public String next() { int b=skip(); StringBuilder sb=new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public int[] toIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } } }
Main.java:79: error: variable s might not have been initialized return Math.min(Math.min(s,t),Math.min(u,v)); ^ Main.java:79: error: variable t might not have been initialized return Math.min(Math.min(s,t),Math.min(u,v)); ^ Main.java:79: error: variable u might not have been initialized return Math.min(Math.min(s,t),Math.min(u,v)); ^ Main.java:79: error: variable v might not have been initialized return Math.min(Math.min(s,t),Math.min(u,v)); ^ 4 errors
s134664484
p00426
Java
import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.math.BigInteger; import java.math.BigDecimal; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static final long LINF=Long.MAX_VALUE/2; static int n,m,a,b,c; static Deque<Integer> queA,queB,queC; public static void main(String[] args) throws IOException{ InputReader ir=new InputReader(in); while(true){ n=ir.nextInt(); m=ir.nextInt(); if(n==0&&m==0) break; queA=new ArrayDeque<Integer>(); queB=new ArrayDeque<Integer>(); queC=new ArrayDeque<Integer>(); a=ir.nextInt(); for(int i=0;i<a;i++) queA.offerFirst(ir.nextInt()); b=ir.nextInt(); for(int i=0;i<b;i++) queB.offerFirst(ir.nextInt()); c=ir.nextInt(); for(int i=0;i<c;i++) queC.offerFirst(ir.nextInt()); int ans=dfs(0,0); out.println(ans>m?-1:ans); } out.flush(); } public static int dfs(int depth,int prev){ if(depth>m||queA.size()==n||queC.size()==n) return depth; int s=m+1,t=m+1,u=m+1,v=m+1; if(prev!=3&&!queA.isEmpty()&&(queB.isEmpty()||queA.peekFirst()>queB.peekFirst())){ int temp=queA.pollFirst(); queB.offerFirst(temp); s=dfs(depth+1,1); queB.pollFirst(); queA.offerFirst(temp); } if(prev!=4&&!queC.isEmpty()&&(queB.isEmpty()||queC.peekFirst()>queB.peekFirst())){ int temp=queC.pollFirst(); queB.offerFirst(temp); t=dfs(depth+1,2); queB.pollFirst(); queC.offerFirst(temp); } if(!queB.isEmpty()){ if(prev!=1){ if(queA.isEmpty()){ int temp=queB.pollFirst(); queA.offerFirst(temp); u=dfs(depth+1,3); queA.pollFirst(); queB.offerFirst(temp); } else if(queB.peekFirst()>queA.peekFirst()){ int temp=queB.pollFirst(); queA.offerFirst(temp); u=dfs(depth+1,3); queA.pollFirst(); queB.offerFirst(temp); } } if(prev!=2){ if(queC.isEmpty()){ int temp=queB.pollFirst(); queC.offerFirst(temp); v=dfs(depth+1,4); queC.pollFirst(); queB.offerFirst(temp); } else if(queB.peekFirst()>queC.peekFirst()){ int temp=queB.pollFirst(); queC.offerFirst(temp); v=dfs(depth+1,4); queC.pollFirst(); queB.offerFirst(temp); } } } } return Math.min(Math.min(s,t),Math.min(u,v)); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in;} public int readByte() { if(lenbuf==-1) throw new InputMismatchException(); if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return -1; } return buffer[curbuf++]; } public boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;} public String next() { int b=skip(); StringBuilder sb=new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public int[] toIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } } }
Main.java:99: error: illegal start of type return Math.min(Math.min(s,t),Math.min(u,v)); ^ Main.java:99: error: <identifier> expected return Math.min(Math.min(s,t),Math.min(u,v)); ^ Main.java:99: error: <identifier> expected return Math.min(Math.min(s,t),Math.min(u,v)); ^ Main.java:180: error: class, interface, enum, or record expected } ^ 4 errors
s652676826
p00426
Java
import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.math.BigInteger; import java.math.BigDecimal; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static final long LINF=Long.MAX_VALUE/2; static int n,m,a,b,c; static Deque<Integer> queA,queB,queC; public static void main(String[] args) throws IOException{ InputReader ir=new InputReader(in); while(true){ n=ir.nextInt(); m=ir.nextInt(); if(n==0&&m==0) break; queA=new ArrayDeque<Integer>(); queB=new ArrayDeque<Integer>(); queC=new ArrayDeque<Integer>(); a=ir.nextInt(); if(a!=0){ for(int i=0;i<a;i++) queA.offerFirst(ir.nextInt()); } b=ir.nextInt(); if(b!=0){ for(int i=0;i<b;i++) queB.offerFirst(ir.nextInt()); } c=ir.nextInt(); if(c!=0){ for(int i=0;i<c;i++) queC.offerFirst(ir.nextInt()); } int ans=dfs(0); out.println(ans>m?-1:ans); } out.flush(); } public static int dfs(int depth){ if(depth>m||queA.size()==n||queC.size()==n) return depth; int s=m+1,t=m+1,u=m+1,v=m+1; if(!queA.isEmpty()){ if(queB.isEmpty()||(!queB.isEmpty()&&queA.peekFirst()>queB.peekFirst())){ int temp=queA.pollFirst(); queB.offerFirst(temp); s=dfs(depth+1); queB.pollFirst(); queA.offerFirst(temp); } } if(!queC.isEmpty()){ if(queB.isEmpty()||(!queB.isEmpty()&&queC.peekFirst()>queB.peekFirst())){ int temp=queC.pollFirst(); queB.offerFirst(temp); t=dfs(depth+1); queB.pollFirst(); queC.offerFirst(temp); } } if(!queB.isEmpty()){ if(queA.isEmpty()){ int temp=queB.pollFirst(); queA.offerFirst(temp); u=dfs(depth+1,3); queA.pollFirst(); queB.offerFirst(temp); } else if(queB.peekFirst()>queA.peekFirst()){ int temp=queB.pollFirst(); queA.offerFirst(temp); u=dfs(depth+1,3); queA.pollFirst(); queB.offerFirst(temp); } if(queC.isEmpty()){ int temp=queB.pollFirst(); queC.offerFirst(temp); v=dfs(depth+1,4); queC.pollFirst(); queB.offerFirst(temp); } else if(queB.peekFirst()>queC.peekFirst()){ int temp=queB.pollFirst(); queC.offerFirst(temp); v=dfs(depth+1,4); queC.pollFirst(); queB.offerFirst(temp); } } return Math.min(Math.min(s,t),Math.min(u,v)); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in;} public int readByte() { if(lenbuf==-1) throw new InputMismatchException(); if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return -1; } return buffer[curbuf++]; } public boolean isSpaceChar(int c){return !(c>=33&&c<=126);} private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;} public String next() { int b=skip(); StringBuilder sb=new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public int[] toIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } } }
Main.java:78: error: method dfs in class Main cannot be applied to given types; u=dfs(depth+1,3); ^ required: int found: int,int reason: actual and formal argument lists differ in length Main.java:85: error: method dfs in class Main cannot be applied to given types; u=dfs(depth+1,3); ^ required: int found: int,int reason: actual and formal argument lists differ in length Main.java:92: error: method dfs in class Main cannot be applied to given types; v=dfs(depth+1,4); ^ required: int found: int,int reason: actual and formal argument lists differ in length Main.java:99: error: method dfs in class Main cannot be applied to given types; v=dfs(depth+1,4); ^ required: int found: int,int reason: actual and formal argument lists differ in length 4 errors
s801187711
p00426
C
#include<stdio.h> struct cup{ int num; int item[15]; cup *next; } int put(cup *old,cup *new) { if(old.item[old.num-1]<new.item[new.num-1]){ new.item[new.num]=old.item[old.num-1]; new.num++; old.num--; return TRUE; } return FALSE; } void scan(cup *first){ int a; scanf("%d\n",&first.num); for(a=0;a<first.num;a++){ scanf("%d\n",&first.item[a]); } if (first.next==NULL) { return; } scan(first.next); } int main(int argc, char const *argv[]) { int n,cn,i; cup a,b,c; a.next=&b; b.next=&c; c.next=NULL; long m,j,count,min; scanf("%d %ld\n",&n,&m); while(n>0 && m>0){ scan(&a); scanf("%d %ld\n",&n,&m); } return 0; }
main.c:6:5: error: unknown type name 'cup' 6 | cup *next; | ^~~ main.c:9:1: error: expected ';', identifier or '(' before 'int' 9 | int put(cup *old,cup *new) { | ^~~ main.c:9:9: error: unknown type name 'cup' 9 | int put(cup *old,cup *new) { | ^~~ main.c:9:18: error: unknown type name 'cup' 9 | int put(cup *old,cup *new) { | ^~~ main.c:19:11: error: unknown type name 'cup' 19 | void scan(cup *first){ | ^~~ main.c: In function 'main': main.c:33:3: error: unknown type name 'cup'; use 'struct' keyword to refer to the type 33 | cup a,b,c; | ^~~ | struct main.c:34:4: error: request for member 'next' in something not a structure or union 34 | a.next=&b; | ^ main.c:35:4: error: request for member 'next' in something not a structure or union 35 | b.next=&c; | ^ main.c:36:4: error: request for member 'next' in something not a structure or union 36 | c.next=NULL; | ^ main.c:40:7: error: implicit declaration of function 'scan'; did you mean 'scanf'? [-Wimplicit-function-declaration] 40 | scan(&a); | ^~~~ | scanf
s108059404
p00426
C
#include<stdio.h> struct cup{ int num; int item[15]; } int put(struct cup *old,struct cup *new) { if(old.item[old.num-1]<new.item[new.num-1]){ new.item[new.num]=old.item[old.num-1]; new.num++; old.num--; return TRUE; } return FALSE; } int main(int argc, char const *argv[]) { int n,cn,i; struct cup a[3]; long m,j,count,min; scanf("%d %ld\n",&n,&m); while(n>0 && m>0){ for(j=0;j<3;i++){ scanf("%d",&a[j].num); for(i=0;i<a[j].num;i++){ scanf("%d",&a[j].item[i]); } } scanf("%d %ld\n",&n,&m); } return 0; }
main.c:8:1: error: expected ';', identifier or '(' before 'int' 8 | int put(struct cup *old,struct cup *new) { | ^~~ main.c: In function 'put': main.c:9:11: error: 'old' is a pointer; did you mean to use '->'? 9 | if(old.item[old.num-1]<new.item[new.num-1]){ | ^ | -> main.c:9:20: error: 'old' is a pointer; did you mean to use '->'? 9 | if(old.item[old.num-1]<new.item[new.num-1]){ | ^ | -> main.c:9:31: error: 'new' is a pointer; did you mean to use '->'? 9 | if(old.item[old.num-1]<new.item[new.num-1]){ | ^ | -> main.c:9:40: error: 'new' is a pointer; did you mean to use '->'? 9 | if(old.item[old.num-1]<new.item[new.num-1]){ | ^ | -> main.c:10:12: error: 'new' is a pointer; did you mean to use '->'? 10 | new.item[new.num]=old.item[old.num-1]; | ^ | -> main.c:10:21: error: 'new' is a pointer; did you mean to use '->'? 10 | new.item[new.num]=old.item[old.num-1]; | ^ | -> main.c:10:30: error: 'old' is a pointer; did you mean to use '->'? 10 | new.item[new.num]=old.item[old.num-1]; | ^ | -> main.c:10:39: error: 'old' is a pointer; did you mean to use '->'? 10 | new.item[new.num]=old.item[old.num-1]; | ^ | -> main.c:11:12: error: 'new' is a pointer; did you mean to use '->'? 11 | new.num++; | ^ | -> main.c:12:12: error: 'old' is a pointer; did you mean to use '->'? 12 | old.num--; | ^ | -> main.c:13:16: error: 'TRUE' undeclared (first use in this function) 13 | return TRUE; | ^~~~ main.c:13:16: note: each undeclared identifier is reported only once for each function it appears in main.c:15:12: error: 'FALSE' undeclared (first use in this function) 15 | return FALSE; | ^~~~~
s477633514
p00426
C
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct{ int num; int *cups; }HANOI; int n,m; int min; void HanoiMove(HANOI *Hanoi, HANOI *prev, int count){ int i,j,k; int check, count_left, count_right; HANOI *Move_left, *Move_right; Move_left=(HANOI *)calloc(4,sizeof(HANOI)); for(i=0;i<4;i++){ Move_left[i].cups=(int *)calloc(n,sizeof(int)); } Move_right=(HANOI *)calloc(4,sizeof(HANOI)); for(i=0;i<4;i++){ Move_right[i].cups=(int *)calloc(n,sizeof(int)); } for(i=1;i<4;i++){ if(Hanoi[i].num==n && count<min){ min = count; } } count_left=count_right=count; for(i=1;i<4;i++){ if(Hanoi[i].num==0) continue; if(i>=2){ for(j=1;j<4;j++){ Move_left[j].num = Hanoi[j].num; for(k=1;k<=Hanoi[j].num;k++){ Move_left[j].cups[k] = Hanoi[j].cups[k]; } } if(prev==NULL){ prev=(HANOI *)calloc(4,sizeof(HANOI)); for(j=0;j<4;j++){ prev[j].cups=(int *)calloc(n,sizeof(int)); } } if(Move_left[i].cups[Move_left[i].num]>Move_left[i-1].cups[Move_left[i-1].num]){ Move_left[i-1].num++; Move_left[i-1].cups[Move_left[i-1].num]=Move_left[i].cups[Move_left[i].num]; Move_left[i].cups[Move_left[i].num]=0; Move_left[i].num--; count_left++; check=0; for(j=1;j<4;j++){ if(prev!=NULL && Move_left[j].num==prev[j].num){ check+=1; } } if(prev==NULL || check<3){ for(j=1;j<4;j++){ prev[j].num = Hanoi[j].num; for(k=1;k<=Hanoi[j].num;k++){ prev[j].cups[k] = Hanoi[j].cups[k]; } } for(j=1;j<4;j++){ Hanoi[j].num = Move_left[j].num; for(k=1;k<=Move_left[j].num;k++){ Hanoi[j].cups[k] = Move_left[j].cups[k]; } } HanoiMove(Hanoi, prev, count_left); } } } if(i<=2){ for(j=1;j<4;j++){ Move_right[j].num = Hanoi[j].num; for(k=1;k<=Hanoi[j].num;k++){ Move_right[j].cups[k] = Hanoi[j].cups[k]; } } if(prev==NULL){ prev=(HANOI *)calloc(4,sizeof(HANOI)); for(j=0;j<4;j++){ prev[j].cups=(int *)calloc(n,sizeof(int)); } } if(Move_right[i].cups[Move_right[i].num]>Move_right[i+1].cups[Move_right[i+1].num]){ Move_right[i+1].num++; Move_right[i+1].cups[Move_right[i+1].num]=Move_right[i].cups[Move_right[i].num]; Move_right[i].cups[Move_right[i].num]=0; Move_right[i].num--; count_right++; check=0; for(j=1;j<4;j++){ if(prev!=NULL && Move_right[j].num==prev[j].num){ check+=1; } } if(prev==NULL || check<3){ for(j=1;j<4;j++){ prev[j].num = Hanoi[j].num; for(k=1;k<=Hanoi[j].num;k++){ prev[j].cups[k] = Hanoi[j].cups[k]; } } for(j=1;j<4;j++){ Hanoi[j].num = Move_right[j].num; for(k=1;k<=Move_right[j].num;k++){ Hanoi[j].cups[k] = Move_right[j].cups[k]; } } HanoiMove(Hanoi, prev, count_right); } } } } return; } int main(void){ int i,j; HANOI *Hanoi, *prev; Hanoi=(HANOI *)calloc(4,sizeof(HANOI)); while(scanf("%d %d",&n,&m)!=EOF){ if(n==0 && m==0) break; min = INT_MAX; for(i=0;i<4;i++) Hanoi[i].cups=(int *)calloc(n,sizeof(int)); for(i=1;i<4;i++){ scanf("%d",&Hanoi[i].num); for(j=1;j<=Hanoi[i].num;j++){ scanf("%d",&Hanoi[i].cups[j]); } } prev = NULL; HanoiMove(Hanoi,prev,0); if(min>m) printf("-1\n"); else printf("%d\n",min); } return 0; }
main.c: In function 'main': main.c:135:23: error: 'INT_MAX' undeclared (first use in this function) 135 | min = INT_MAX; | ^~~~~~~ main.c:4:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>' 3 | #include<string.h> +++ |+#include <limits.h> 4 | main.c:135:23: note: each undeclared identifier is reported only once for each function it appears in 135 | min = INT_MAX; | ^~~~~~~
s607612818
p00426
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define LEFT 0 #define RIGHT 1 #define QUEUE_SIZE 1500000 typedef struct{ int num; int cups[15]; }HANOI; typedef struct{ HANOI current[4]; HANOI privious[4]; int count; }QUEUE; int n,m; int min = INT_MAX; HANOI Hanoi[4], Prev[4]; HANOI Move_left[4], Move_right[4]; int queue_top, queue_bottom; QUEUE queue[QUEUE_SIZE]; void Initialize(void){ int i,j; min = INT_MAX; queue_top=queue_bottom=0; for(i=0;i<4;i++){ Hanoi[i].num=0; for(j=0;j<15;j++) Hanoi[i].cups[j]=0; } for(i=0;i<4;i++){ Prev[i].num=0; for(j=0;j<15;j++) Prev[i].cups[j]=0; } return; } void MoveCup(int pos, int which){ if(which==LEFT){ Move_left[pos-1].num++; Move_left[pos-1].cups[Move_left[pos-1].num]=Move_left[pos].cups[Move_left[pos].num]; Move_left[pos].cups[Move_left[pos].num]=0; Move_left[pos].num--; }else if(which==RIGHT){ Move_right[pos+1].num++; Move_right[pos+1].cups[Move_right[pos+1].num]=Move_right[pos].cups[Move_right[pos].num]; Move_right[pos].cups[Move_right[pos].num]=0; Move_right[pos].num--; } return; } void SetQueue(HANOI *insert, int top, int bottom, int count){ int i,j; for(i=1;i<4;i++){ queue[bottom].privious[i].num = queue[top].current[i].num; for(j=1;j<=queue[top].current[i].num;j++){ queue[bottom].privious[i].cups[j] = queue[top].current[i].cups[j]; } } for(i=1;i<4;i++){ queue[bottom].current[i].num = insert[i].num; for(j=1;j<=insert[i].num;j++){ queue[bottom].current[i].cups[j] = insert[i].cups[j]; } } queue[bottom].count=count; return ; } void HanoiMove(HANOI *hanoi, HANOI *prev, int count){ int i,j,k; int count_left, count_right; for(i=0;i<4;i++){ Move_left[i].num=0; for(j=0;j<15;j++) Move_left[i].cups[j]=0; } for(i=0;i<4;i++){ Move_right[i].num=0; for(j=0;j<15;j++) Move_right[i].cups[j]=0; } for(;;){ for(i=1;i<4;i++){ Move_left[i].num = queue[queue_top].current[i].num; Move_right[i].num = queue[queue_top].current[i].num; for(j=1;j<=queue[queue_top].current[i].num;j++){ Move_left[i].cups[j] = queue[queue_top].current[i].cups[j]; Move_right[i].cups[j] = queue[queue_top].current[i].cups[j]; } } for(i=1;i<4;i++){ if(i==2) continue; else if(Move_left[i].num==n && queue[queue_top].count<min){ min = queue[queue_top].count; } } if(queue[queue_top].count>min){ queue_top++; if(queue_top==queue_bottom) break; continue; } count_left=count_right=queue[queue_top].count; for(i=1;i<4;i++){ if(queue[queue_top].current[i].num==0) continue; if(i>=2){ for(j=1;j<4;j++){ Move_left[j].num = queue[queue_top].current[j].num; for(k=1;k<=queue[queue_top].current[j].num;k++){ Move_left[j].cups[k] = queue[queue_top].current[j].cups[k]; } } if(Move_left[i].cups[Move_left[i].num]>Move_left[i-1].cups[Move_left[i-1].num]){ MoveCup(i,LEFT); count_left=queue[queue_top].count+1; if(count_left>m) continue; for(j=1;j<4;j++){ if(Move_left[j].num!=queue[queue_top].privious[j].num){ break; } } if(j<4){ queue_bottom+=1; if(queue_bottom>=QUEUE_SIZE) queue_bottom=0; SetQueue(Move_left, queue_top, queue_bottom, count_left); } } } if(i<=2){ for(j=1;j<4;j++){ Move_right[j].num = queue[queue_top].current[j].num; for(k=1;k<=queue[queue_top].current[j].num;k++){ Move_right[j].cups[k] = queue[queue_top].current[j].cups[k]; } } if(Move_right[i].cups[Move_right[i].num]>Move_right[i+1].cups[Move_right[i+1].num]){ MoveCup(i,RIGHT); count_right=queue[queue_top].count+1; if(count_right>m) continue; for(j=1;j<4;j++){ if(Move_right[j].num!=queue[queue_top].privious[j].num){ break; } } if(j<4){ queue_bottom+=1; if(queue_bottom>=QUEUE_SIZE) queue_bottom=0; SetQueue(Move_right, queue_top, queue_bottom, count_right); } } } } queue_top++; if(queue_top>=QUEUE_SIZE) queue_top=0; if(queue_top==queue_bottom) break; } return; } int main(void){ int i,j; while(scanf("%d %d",&n,&m)!=EOF){ if(n==0 && m==0) break; Initialize(); for(i=1;i<4;i++){ scanf("%d",&Hanoi[i].num); for(j=1;j<=Hanoi[i].num;j++){ scanf("%d",&Hanoi[i].cups[j]); } } for(i=1;i<4;i++){ queue[queue_top].current[i].num = Hanoi[i].num; queue[queue_top].privious[i].num = Hanoi[i].num; for(j=1;j<=Hanoi[i].num;j++){ queue[queue_top].current[i].cups[j] = Hanoi[i].cups[j]; queue[queue_top].privious[i].cups[j] = Hanoi[i].cups[j]; } } HanoiMove(Hanoi,Prev,0); if(min>m) printf("-1\n"); else printf("%d\n",min); } return 0; }
main.c:21:11: error: 'INT_MAX' undeclared here (not in a function) 21 | int min = INT_MAX; | ^~~~~~~ main.c:4:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>' 3 | #include<string.h> +++ |+#include <limits.h> 4 |
s209324694
p00426
C
m,i,j,k,t[16],c[16],p,d; int main(n){ for(*t=1;++i<16;)t[i]=n*=3; for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ for(k=3;k--;) for(scanf("%d",&i);i--;c[j]=k)scanf("%d",&j); for(p=j=k=0;k++<n;) j+=t[n-k]*abs(i=p-c[k]),p=i%2*2+p&3; } return 0; }
main.c:1:1: warning: data definition has no type or storage class 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] main.c:1:3: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:7: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:9: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:15: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:21: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c:1:23: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] 1 | m,i,j,k,t[16],c[16],p,d; | ^ main.c: In function 'main': main.c:2:5: error: type of 'n' defaults to 'int' [-Wimplicit-int] 2 | int main(n){ | ^~~~ main.c:4:14: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 4 | for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | m,i,j,k,t[16],c[16],p,d; main.c:4:14: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 4 | for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ | ^~~~~ main.c:4:14: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:4:36: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 4 | for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ | ^~~~~~ main.c:4:36: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:4:36: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:4:36: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:4:59: error: implicit declaration of function 'fmin' [-Wimplicit-function-declaration] 4 | for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ | ^~~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'fmin' +++ |+#include <math.h> 1 | m,i,j,k,t[16],c[16],p,d; main.c:4:59: warning: incompatible implicit declaration of built-in function 'fmin' [-Wbuiltin-declaration-mismatch] 4 | for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ | ^~~~ main.c:4:59: note: include '<math.h>' or provide a declaration of 'fmin' main.c:4:58: error: lvalue required as left operand of assignment 4 | for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j=fmin(j,t[n]+~j))){ | ^ main.c:8:35: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration] 8 | j+=t[n-k]*abs(i=p-c[k]),p=i%2*2+p&3; | ^~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs' +++ |+#include <stdlib.h> 1 | m,i,j,k,t[16],c[16],p,d;
s858052416
p00426
C
#include <iostream> #include <tuple> #include <map> using namespace std; const int NONE = -1; typedef tuple<int, int, int> Tuple; map<Tuple, int> S; Tuple goal; int n, m; int get_last( int m ) { for ( int i = n - 1; i >= 0; -- i ) { if ( ( m & ( 1 << i ) ) == ( 1 << i ) ) return 1 << i; } return 0; } int remove_last( int m ) { for ( int i = n - 1; i >= 0; -- i ) { if ( ( m & ( 1 << i ) ) == ( 1 << i ) ) return m ^ ( 1 << i ); } return m; } int solve( int A, int B, int C, int turns ) { Tuple tuple = make_tuple( A, B, C ); if ( S.count( tuple ) > 0 && turns >= S[tuple] ) return -1; S[tuple] = turns; if ( turns > m ) return -1; if ( tuple == goal ) return turns; if ( C != 0 ) { int u = get_last(C); int v = get_last(B); if ( u > v ) { int ret = solve( A, B | u, remove_last(C), turns + 1 ); if ( ret != NONE ) return ret; } } return -1; } int main() { while ( cin >> n >> m ) { if ( n == 0 && m == 0 ) break; S.clear(); int T[3] = { 0, 0, 0 }; for ( int i = 0; i < 3; ++ i ) { int k; cin >> k; for ( int j = 0; j < k; ++ j ) { int t; cin >> t; t--; T[i] |= 1 << t; } } goal = make_tuple( T[0], T[1], T[2] ); int ret1 = solve( (1<<n)-1, 0, 0, 0 ); int ret2 = solve( 0, 0, (1<<n)-1, 0 ); if ( ret1 == NONE && ret2 == NONE ) { cout << -1 << endl; } else if ( ret1 != NONE && ret2 != NONE ) { cout << min( ret1, ret2 ) << endl; } else if ( ret1 != NONE ) { cout << ret1 << endl; } else if ( ret2 != NONE ) { cout << ret2 << endl; } } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s310265210
p00426
C
c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
main.c:1:1: warning: data definition has no type or storage class 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int] main.c:1:7: error: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~~ main.c:1:7: error: initializer element is not computable at load time main.c:1:14: error: return type defaults to 'int' [-Wimplicit-int] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~ main.c: In function 'main': main.c:1:14: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'm' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'j' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'k' defaults to 'int' [-Wimplicit-int] main.c:1:35: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} main.c:1:35: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~ main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:57: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~~ main.c:1:57: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:57: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:57: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:64: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ | | | int main.c:1:64: note: expected 'const char *' but argument is of type 'int' main.c:1:99: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ | | | int main.c:1:99: note: expected 'const char *' but argument is of type 'int' main.c:1:124: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ | | | int main.c:1:124: note: expected 'const char *' but argument is of type 'int' main.c:1:153: error: implicit declaration of function 'pow' [-Wimplicit-function-declaration] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'pow' +++ |+#include <math.h> 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} main.c:1:153: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:153: note: include '<math.h>' or provide a declaration of 'pow' main.c:1:162: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs' +++ |+#include <stdlib.h> 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} main.c:1:180: error: implicit declaration of function 'fmin' [-Wimplicit-function-declaration] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~ main.c:1:180: note: include '<math.h>' or provide a declaration of 'fmin' main.c:1:180: warning: incompatible implicit declaration of built-in function 'fmin' [-Wbuiltin-declaration-mismatch] main.c:1:180: note: include '<math.h>' or provide a declaration of 'fmin' main.c:1:188: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:188: note: include '<math.h>' or provide a declaration of 'pow' main.c: At top level: main.c:1:1: warning: array 'c' assumed to have one element 1 | c[];f="%d\n";main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^
s149332767
p00426
C
f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
main.c:1:1: warning: data definition has no type or storage class 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int] main.c:1:3: error: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~~ main.c:1:3: error: initializer element is not computable at load time main.c:1:10: warning: data definition has no type or storage class 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ main.c:1:10: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:14: error: return type defaults to 'int' [-Wimplicit-int] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~ main.c: In function 'main': main.c:1:14: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'm' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'j' defaults to 'int' [-Wimplicit-int] main.c:1:14: error: type of 'k' defaults to 'int' [-Wimplicit-int] main.c:1:35: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} main.c:1:35: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~ main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:57: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~~~ main.c:1:57: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:57: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:57: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:64: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ | | | int main.c:1:64: note: expected 'const char *' but argument is of type 'int' main.c:1:99: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ | | | int main.c:1:99: note: expected 'const char *' but argument is of type 'int' main.c:1:124: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ | | | int main.c:1:124: note: expected 'const char *' but argument is of type 'int' main.c:1:153: error: implicit declaration of function 'pow' [-Wimplicit-function-declaration] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'pow' +++ |+#include <math.h> 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} main.c:1:153: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:153: note: include '<math.h>' or provide a declaration of 'pow' main.c:1:162: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs' +++ |+#include <stdlib.h> 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} main.c:1:180: error: implicit declaration of function 'fmin' [-Wimplicit-function-declaration] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~~ main.c:1:180: note: include '<math.h>' or provide a declaration of 'fmin' main.c:1:180: warning: incompatible implicit declaration of built-in function 'fmin' [-Wbuiltin-declaration-mismatch] main.c:1:180: note: include '<math.h>' or provide a declaration of 'fmin' main.c:1:188: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^~~ main.c:1:188: note: include '<math.h>' or provide a declaration of 'pow' main.c: At top level: main.c:1:10: warning: array 'c' assumed to have one element 1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^
s964664058
p00426
C
#include <stdio.h> #define NMAX 15 #define MMAX 15000000 int cup[3]; int cup_move[4][2] = {{0,1},{1,0},{1,2},{2,1}}; int stack[MMAX][3]; int move(int temp[3],int a,int amin, int amax) { int i,l,m; bool flag; for(m=0;m<4;m++){ if(temp[cup_move[m][0]]>temp[cup_move[m][1]]){ l= 1<<NMAX; while((l & temp[cup_move[m][0]]) == 0) l>>=1; temp[cup_move[m][0]] -= l; temp[cup_move[m][1]] += l; a++; stack[a][0]=temp[0]; stack[a][1]=temp[1]; stack[a][2]=temp[2]; if(a>amax){ return a--; } if(temp[1]==0 && (temp[0]==0 || temp[2]==0)){ if(amin>a) amin=a; return a--; } flag = false; for(i=0;i<a;i++){ if(stack[i][0]==temp[0] && stack[i][1]==temp[1] && stack[i][2]==temp[2]){ a--; temp[0]=stack[a][0]; temp[1]=stack[a][1]; temp[2]=stack[a][2]; flag = true; break; } } if(!flag) amin = move(temp,a,amin,amax); } } return amin; } int main(void) { int n,m; int c_max,c; int i,j; int a; int temp[3]; while(scanf("%d%d", &n, &m) && n+m){ for(i=0;i<3;i++){ cup[i] = 0; scanf("%d", &c_max); for(j=0;j<c_max;j++){ scanf("%d", &c); cup[i] |= 1 << (c-1); } } if(cup[1]==0 && (cup[0]==0 || cup[2]==0)){ printf("0\n"); continue; } for(i=0;i<3;i++){ temp[i]=cup[i]; stack[0][i]=cup[i]; } a = move(temp,0,m,m); if(a>m){ printf("-1\n"); }else{ printf("%d\n",a); } } return 0; }
main.c: In function 'move': main.c:13:9: error: unknown type name 'bool' 13 | bool flag; | ^~~~ main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | main.c:34:32: error: 'false' undeclared (first use in this function) 34 | flag = false; | ^~~~~ main.c:34:32: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:34:32: note: each undeclared identifier is reported only once for each function it appears in main.c:41:48: error: 'true' undeclared (first use in this function) 41 | flag = true; | ^~~~ main.c:41:48: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
s690615519
p00426
C++
{ finish.push(i); } for(int i=0;i<3;i++) { int size; cin>>size; for(int j=0;j<size;j++) { int tmp; cin>>tmp; table[i].push(tmp); } } //stack,step; queue<pair<pair<stack<char>,stack<char> >,pair<stack<char> ,int> > > qu; qu.push(make_pair(make_pair(table[0],table[1]),make_pair(table[2],0))); int ans=-1; while(!qu.empty()) { stack<char>a=qu.front().first.first; stack<char>b=qu.front().first.second; stack<char>c=qu.front().second.first; int step=qu.front().second.second; qu.pop(); if(a==finish || c==finish) { ans=step; break; } if(hash.find(make_pair(a,c))!=hash.end()) continue; hash.insert(make_pair(a,c)); if(step==m) continue; if(!a.empty()) { if(b.empty()||a.top()>b.top() ) { int tmp=a.top(); a.pop(); b.push(tmp); if(hash.find(make_pair(a,c))==hash.end()) qu.push(make_pair(make_pair(a,b),make_pair(c,step+1))); tmp=b.top(); b.pop(); a.push(tmp); } } if(!b.empty()) { if(a.empty()||a.top()<b.top() ) { int tmp=b.top(); b.pop(); a.push(tmp); if(hash.find(make_pair(a,c))==hash.end()) qu.push(make_pair(make_pair(a,b),make_pair(c,step+1))); tmp=a.top(); a.pop(); b.push(tmp); } if(c.empty()||c.top()<b.top() ) { int tmp=b.top(); b.pop(); c.push(tmp); if(hash.find(make_pair(a,c))==hash.end()) qu.push(make_pair(make_pair(a,b),make_pair(c,step+1))); tmp=c.top(); c.pop(); b.push(tmp); } } if(!c.empty()) { if(b.empty()||b.top()<c.top() ) { int tmp=c.top(); c.pop(); b.push(tmp); if(hash.find(make_pair(a,c))==hash.end()) qu.push(make_pair(make_pair(a,b),make_pair(c,step+1))); tmp=b.top(); b.pop(); c.push(tmp); } } } cout<<ans<<endl; } }
a.cc:2:9: error: expected unqualified-id before '{' token 2 | { | ^ a.cc:5:7: error: expected unqualified-id before 'for' 5 | for(int i=0;i<3;i++) | ^~~ a.cc:5:19: error: 'i' does not name a type 5 | for(int i=0;i<3;i++) | ^ a.cc:5:23: error: 'i' does not name a type 5 | for(int i=0;i<3;i++) | ^ a.cc:17:7: error: 'queue' does not name a type 17 | queue<pair<pair<stack<char>,stack<char> >,pair<stack<char> ,int> > > qu; | ^~~~~ a.cc:18:7: error: 'qu' does not name a type 18 | qu.push(make_pair(make_pair(table[0],table[1]),make_pair(table[2],0))); | ^~ a.cc:20:7: error: expected unqualified-id before 'while' 20 | while(!qu.empty()) | ^~~~~ a.cc:101:7: error: 'cout' does not name a type 101 | cout<<ans<<endl; | ^~~~ a.cc:102:5: error: expected declaration before '}' token 102 | } | ^ a.cc:104:1: error: expected declaration before '}' token 104 | } | ^
s331891207
p00426
C++
#include<iostream> #include<vector> #include<queue>
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s635477879
p00426
C++
#include<cstdio> #include<vector> #include<queue> #include<algorithm> using namespace std; typedef struct Cup { vector<int>P[3]; int T; bool operator <(const Cup &a)const{ return T>a.T;}; }S; int N,M; bool f[3][3][3][3][3][3][3][3][3][3][3][3][3][3][3]; int main() { for(;scanf("%d%d",&N,&M),N;) { Cup tmp; int i,j,t,q,R=-1; memset(f,0,sizeof(f)); for(i=0;i<3;i++) { for(scanf("%d",&t),j=0;j<t;j++) { scanf("%d",&q); tmp.P[i].push_back(q); } } tmp.T=0; priority_queue<Cup> Q; Q.push(tmp); while(!Q.empty()) { tmp=Q.top();Q.pop(); int p[15]; for(int i=0;i<3;i++) for(int j=0;j<tmp.P[i].size();j++) p[tmp.P[i][j]-1]=i; if(f[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]][p[6]][p[7]][p[8]][p[9]][p[10]][p[11]][p[12]][p[13]][p[14]])continue; if(tmp.T>M)continue; if(tmp.P[0].size()==N||tmp.P[2].size()==N) { R=tmp.T; break; } for(int i=0;i<3;i++) for(int j=-1;j<2;j++) { if(j&&i+j>=0&&i+j<3&&!tmp.P[i].empty()) { int tmp1=tmp.P[i].back(); int tmp2=-1; if(!tmp.P[i+j].empty()) tmp2=tmp.P[i+j].back(); if(tmp1>tmp2) { Cup ins=tmp; ins.P[i+j].push_back(tmp1); ins.P[i].pop_back(); ins.T++; Q.push(ins); f[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]][p[6]][p[7]][p[8]][p[9]][p[10]][p[11]][p[12]][p[13]][p[14]]=1; } } } } printf("%d\n",R); } }
a.cc: In function 'int main()': a.cc:20:17: error: 'memset' was not declared in this scope 20 | memset(f,0,sizeof(f)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std;
s876925920
p00426
C++
#include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <string> #include <functional> #include <array> #include <stack> #include <queue> #include <chrono> #include <numeric> #include <memory.h> #include <map> #include <math.h> #include "graph.h" #pragma warning(disable:4996) #define REP(i,n) for(int i = 0 ; i < n ; ++i) typedef long long Int; const double PI = 3.141592653589793238; const Int INF = 999999999999; using namespace std; int dx[4] = { 0, -1, 0, 1 }; int dy[4] = { 1, 0, -1, 0 }; struct state{ vector<int> A, B, C; int step = 0; }; int main() { int n, m; while (cin >> n >> m, n&&m){ queue<state> que; state s; REP(i,3){ int k; cin >> k; REP(j,k){ int a; cin >> a; if (i ==0) s.A.push_back(a); if (i == 1) s.B.push_back(a); if (i == 2) s.C.push_back(a); } } que.push(s); while (!que.empty()){ state now = que.front(); que.pop(); if ((now.B.empty() && now.C.empty()) || (now.B.empty() && now.A.empty())){ cout << now.step << endl; break; } if (now.step > m){ cout << -1 << endl; break; } if (!now.A.empty() && (now.B.empty() || (now.A.back() > now.B.back()))){ state next = now; next.B.push_back(next.A.back()); next.A.pop_back(); ++next.step; que.push(next); } if (!now.B.empty() && (now.A.empty() || (now.A.back() < now.B.back()))){ state next = now; next.A.push_back(next.B.back()); next.B.pop_back(); ++next.step; que.push(next); } if (!now.B.empty() && (now.C.empty() || (now.B.back() > now.C.back()))){ state next = now; next.C.push_back(next.B.back()); next.B.pop_back(); ++next.step; que.push(next); } if (!now.C.empty() && (now.B.empty() || (now.B.back() < now.C.back()))){ state next = now; next.B.push_back(next.C.back()); next.C.pop_back(); ++next.step; que.push(next); } } } return 0; }
a.cc:16:10: fatal error: graph.h: No such file or directory 16 | #include "graph.h" | ^~~~~~~~~ compilation terminated.
s956296259
p00426
C++
#include<iostream> #include<vector> #include<queue>
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s239876623
p00426
C++
3 10 1 1 1 3 1 2 4 100 1 3 3 1 2 4 0 5 100 0 4 2 3 4 5 1 1 10 10000 4 1 4 5 9 3 2 3 7 3 6 8 10 15 15000000 4 1 2 9 12 6 4 7 11 13 14 15 5 3 5 6 8 10 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 10 | ^
s044785073
p00426
C++
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;i++) using namespace std; int n, m; struct puzzle { char f[3][15]; int len[3], cnt; }; bool operator==(const puzzle&left, const puzzle&right) { rep(i, 3) { if (strcmp(left.f[i], right.f[i]))return false; } return true; } template<> class hash<puzzle> { public: inline size_t operator()(const puzzle&p) const { size_t cnt = 0; rep(i, 3) { hash<string>H; cnt += (i + 1)*H(p.f[i]); } return cnt; } }; int main() { while (scanf("%d%d", &n, &m), n) { puzzle in{}; rep(i, 3) { scanf("%d", &in.len[i]); rep(j, in.len[i])scanf("%d", &in.f[i][j]); } unordered_map<puzzle, bool>mp; queue<puzzle>que; mp[in] = true; que.push(in); while (!que.empty()) { puzzle u = que.front(); que.pop(); if (u.len[0] == n || u.len[2] == n) { printf("%d\n", u.cnt); goto g; } if (u.cnt >= m)continue; rep(k, 2)rep(t, 2) { int i, j; if (t) { i = k, j = k + 1; } else { i = k + 1; j = k; } if (u.len[i] == 0)continue; if (u.len[j] > 0 && (u.f[i][u.len[i] - 1] < u.f[j][u.len[j] - 1])) continue; puzzle v = u; v.len[i]--; v.len[j]++; swap(v.f[i][v.len[i]], v.f[j][v.len[j] - 1]); if (!mp[v]) { mp[v] = true; v.cnt++; que.push(v); } } } puts("-1"); g:; } }
a.cc:17:7: error: explicit specialization of 'template<class _Tp> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive] 17 | class hash<puzzle> { | ^~~~~~~~~~~~
s870778045
p00426
C++
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;i++) using namespace std; int n, m; struct puzzle { char f[3][15]; int len[3], cnt; }; bool operator==(const puzzle&left, const puzzle&right) { rep(i, 3) { if (strcmp(left.f[i], right.f[i]))return false; } return true; } template<> struct hash<puzzle> { inline size_t operator()(const puzzle&p) const { size_t cnt = 0; rep(i, 3) { hash<string>H; cnt += (i + 1)*H(p.f[i]); } return cnt; } }; int main() { while (scanf("%d%d", &n, &m), n) { puzzle in{}; rep(i, 3) { scanf("%d", &in.len[i]); rep(j, in.len[i])scanf("%d", &in.f[i][j]); } unordered_map<puzzle, bool>mp; queue<puzzle>que; mp[in] = true; que.push(in); while (!que.empty()) { puzzle u = que.front(); que.pop(); if (u.len[0] == n || u.len[2] == n) { printf("%d\n", u.cnt); goto g; } if (u.cnt >= m)continue; rep(k, 2)rep(t, 2) { int i, j; if (t) { i = k, j = k + 1; } else { i = k + 1; j = k; } if (u.len[i] == 0)continue; if (u.len[j] > 0 && (u.f[i][u.len[i] - 1] < u.f[j][u.len[j] - 1])) continue; puzzle v = u; v.len[i]--; v.len[j]++; swap(v.f[i][v.len[i]], v.f[j][v.len[j] - 1]); if (!mp[v]) { mp[v] = true; v.cnt++; que.push(v); } } } puts("-1"); g:; } }
a.cc:17:8: error: explicit specialization of 'template<class _Tp> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive] 17 | struct hash<puzzle> { | ^~~~~~~~~~~~
s321774221
p00426
C++
#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; int N, M; int solve(array<int, 3> const& target) { queue<array<int, 3>> q; int num = 0; rep(i, N) num |= 1 << i; q.push(array<int, 3>{{num, 0, 0}}); q.push(array<int, 3>{{0, 0, num}}); unordered_map<array<int, 3>, int> mp; mp[array<int, 3>{{num, 0, 0}}] = 0; mp[array<int, 3>{{0, 0, num}}] = 0; while(!q.empty()) { auto v = q.front(); q.pop(); if(v == target) { return mp[v]; } rep(i, v.size()) { for(int k=N-1; k>=0; k--) { if(v[i] >> k & 1) { if(i + 1 < 3) { auto nv = v; nv[i] ^= 1 << k; if(nv[i + 1] < (1<<k)) { nv[i + 1] ^= 1 << k; if(mp.find(nv) == mp.end() && mp[v] + 1 <= M) { mp[nv] = mp[v] + 1; q.push(nv); } } } if(i - 1 >= 0) { auto nv = v; nv[i] ^= 1 << k; if(nv[i - 1] < (1<<k)) { nv[i - 1] ^= 1 << k; if(mp.find(nv) == mp.end() && mp[v] + 1 <= M) { mp[nv] = mp[v] + 1; q.push(nv); } } } break; } } } } return -1; } int main() { while(cin >> N >> M && (N|M)) { array<int, 3> cups; rep(i, 3) { int n; cin >> n; int num = 0; rep(j, n) { int k; cin >> k; k--; num |= 1 << k; } cups[i] = num; } cout << solve(cups) << endl; } return 0; }
a.cc: In function 'int solve(const std::array<int, 3>&)': a.cc:26:37: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::array<int, 3>; _Tp = int; _Hash = std::hash<std::array<int, 3> >; _Pred = std::equal_to<std::array<int, 3> >; _Alloc = std::allocator<std::pair<const std::array<int, 3>, int> >]' 26 | unordered_map<array<int, 3>, int> mp; | ^~ In file included from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::array<int, 3>; _Tp = int; _Hash = std::hash<std::array<int, 3> >; _Pred = std::equal_to<std::array<int, 3> >; _Alloc = std::allocator<std::pair<const std::array<int, 3>, int> >]' is implicitly deleted because the default definition would be ill-formed: 148 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h: At global scope: /usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::array<int, 3>; _Value = std::pair<const std::array<int, 3>, int>; _Alloc = std::allocator<std::pair<const std::array<int, 3>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::array<int, 3> >; _Hash = std::hash<std::array<int, 3> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/unordered_map.h:33: /usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::array<int, 3>; _Value = std::pair<const std::array<int, 3>, int>; _Alloc = std::allocator<std::pair<const std::array<int, 3>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::array<int, 3> >; _Hash = std::hash<std::array<int, 3> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::array<int, 3>; _Value = std::pair<const std::array<int, 3>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::array<int, 3> >; _Hash = std::hash<std::array<int, 3> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/hashtable.h:35: /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::array<int, 3>; _Value = std::pair<const std::array<int, 3>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::array<int, 3> >; _Hash = std::hash<std::array<int, 3> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::array<int, 3>; _Value = std::pair<const std::array<int, 3>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::array<int, 3> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' /usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::array<int, 3> >]': /usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::array<int, 3> >::hash()' 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::array<int, 3> >::hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::array<int, 3>, false>::__hash_enum()' /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::array<int, 3>; bool <anonymous> = false]' 83 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::array<int, 3>; bool <anonymous> = false]' is private within this context 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::array<int, 3>; _Value = std::pair<const std::array<int, 3>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::array<int, 3> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed: 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::array<int, 3> >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::array<int, 3> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::array<int, 3> >::~hash()' /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::array<int, 3> >::~hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::array<int, 3>; bool <anonymous> = false]' is private within this context /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::array<int, 3>, std::pair<const std::array<int, 3>, int>, std::__detail::_Select1st, std::hash<std::array<int, 3> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' /usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::array<int, 3>, std::pair<const std::array<int, 3>, int>, std::__detail::_Select1st, std::hash<std::array<int, 3> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed: 1306 | struct _Hash_code_base | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::array<int, 3> >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std
s560606359
p00426
C++
#include <bits/stdc++.h> #include <spdlog/spdlog.h> #define SIZE 300005 #define MOD 1000000007LL #define EPS 1e-10 #define INF 1 << 30 #define LLINF LLONG_MAX/3 #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define DOWN(i,b,a) for(int i=b;i>=a;i--) #define SET(a,c) memset(a,c,sizeof a) #define BIT(i,j) ((i)>>(j))&1 #define ALL(o) (o).begin(), (o).end() #define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end()) #define SQ(x) ((x)*(x)) using namespace std; typedef long long ll; typedef pair<ll,ll> Pll; typedef pair<int, int> Pii; typedef pair<double, double> Pdd; typedef complex<double> dcomplex; template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}} ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);} ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);} ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;} ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;} int p[20]; int f(int a, int b, int c) { if(!b&&!c) return 0; int s = (a|b|c)>>1; int t = 0; while(s&1) {t++;s>>=1;} if(1&a) return f(a>>1,b>>1,c>>1); if(1&b) return f(c>>1,b>>1,a>>1)+p[t]; if(1&c) return f(a>>1,b>>1,c>>1)+2*p[t]; } int main() { int n,m; REP(i,20) { p[i] = pow(3,i); } while(cin >> n >> m,n) { int a[3] = {0}; REP(i,3) { int t,u; cin >> t; REP(j,t) { cin >> u; a[i] |= 1 << u-1; } } int ans = min(f(a[0],a[1],a[2]),f(a[2],a[1],a[0])); cout << (ans>m?-1:ans) << endl; } }
a.cc:2:10: fatal error: spdlog/spdlog.h: No such file or directory 2 | #include <spdlog/spdlog.h> | ^~~~~~~~~~~~~~~~~ compilation terminated.
s073112532
p00426
C++
#include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <cstring> #include <numeric> #include <algorithm> #include <functional> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) using namespace std; typedef pair<int, int> pii; typedef long long ll; const pii Dir[8] = { //????????? { 0,1 },{ 0,-1 },{ 1,0 },{ -1,0 }, { 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 } }; template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*) array, (T*) (array + N), val); } signed main() { int n, m; scanf("%d %d", &n, &m); ll dp[16] = {}; dp[0] = 1; rep(i,1, n+1) { dp[i] = dp[i - 1] * 3; } vector<int> pos(n); REP(i, 3) { int c; scanf("%d", &c); REP(j, c) { int size; scanf("%d", &size); pos[size-1] = i; } } //reverse(ALL(pos)); ll ans = 0,ans2 = 0; bool curs = 0; REP(i, n) { if (pos[i] % 2) { ans += dp[n - i - 1]; curs = 1-curs; } else if (curs*2-pos[i]) { ans += dp[n - i - 1] + 1; } } bool curs = 1; REP(i, n) { if (pos[i] % 2) { ans2 += dp[n - i - 1]; curs = 1 - curs; } else if (curs * 2 - pos[i]) { ans2 += dp[n - i - 1] + 1; } } printf("%lld\n", min(ans2, ans)); return 0; }
a.cc: In function 'int main()': a.cc:77:14: error: redeclaration of 'bool curs' 77 | bool curs = 1; | ^~~~ a.cc:67:14: note: 'bool curs' previously declared here 67 | bool curs = 0; | ^~~~
s455004811
p00426
C++
#include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <cstring> #include <numeric> #include <algorithm> #include <functional> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) using namespace std; typedef pair<int, int> pii; typedef long long ll; const pii Dir[8] = { //????????? { 0,1 },{ 0,-1 },{ 1,0 },{ -1,0 }, { 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 } }; template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*) array, (T*) (array + N), val); } signed main() { int n, m; scanf("%d %d", &n, &m); ll dp[16] = {}; dp[0] = 1; rep(i,1, n+1) { dp[i] = dp[i - 1] * 3; } vector<int> pos(n); REP(i, 3) { int c; scanf("%d", &c); REP(j, c) { int size; scanf("%d", &size); pos[size-1] = i; } } //reverse(ALL(pos)); ll ans = 0,ans2 = 0; bool curs = 0; REP(i, n) { if (pos[i] % 2) { ans += dp[n - i - 1]; curs = 1-curs; } else if (curs*2-pos[i]) { ans += dp[n - i - 1] + 1; } } bool curs = 1; REP(i, n) { if (pos[i] % 2) { ans2 += dp[n - i - 1]; curs = 1 - curs; } else if (curs * 2 - pos[i]) { ans2 += dp[n - i - 1] + 1; } } printf("%lld\n", min(ans2, ans)); return 0; }
a.cc: In function 'int main()': a.cc:77:14: error: redeclaration of 'bool curs' 77 | bool curs = 1; | ^~~~ a.cc:67:14: note: 'bool curs' previously declared here 67 | bool curs = 0; | ^~~~
s978914577
p00426
C++
#include <iostream> #include <stack> #include <queue> #include <deque> #include <vector> #include <functional> #define INPUT_FROM_FILE (1) #if INPUT_FROM_FILE #include <fstream> #endif const char Max_n = 15; int f_A(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_B(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_C(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_A(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_B.empty() && stack_C.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ stack_A.pop_front(); return f_A(stack_A, stack_B, stack_C); } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ int n = 0; stack_B.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + int(pow(3, n)); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ int n = 0; stack_C.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); } std::cout << "error f_A" << std::endl; exit(0); return 0; } int f_B(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_A.empty() && stack_C.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ int n = 0; stack_A.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ stack_B.pop_front(); return f_B(stack_A, stack_B, stack_C); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ int n = 0; stack_C.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; } std::cout << "error f_B" << std::endl; exit(0); return 0; } int f_C(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_A.empty() && stack_B.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ int n = 0; stack_A.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ int n = 0; stack_B.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + int(pow(3, n)); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ stack_C.pop_front(); return f_C(stack_A, stack_B, stack_C); } std::cout << "error f_C" << std::endl; exit(0); return 0; } int main(int argc, char **argv){ #if INPUT_FROM_FILE std::ifstream ifs("test.txt"); #endif int n = 0; int m = 0; #if INPUT_FROM_FILE while(ifs >> n >> m, (n != 0 || m != 0)){ #else while(std::cin >> n >> m, (n != 0 || m != 0)){ #endif std::deque<char> tray[3]; for(int i = 0; i < 3; i++){ int num_cups = 0; #if INPUT_FROM_FILE ifs >> num_cups; #else std::cin >> num_cups; #endif for(int j = 0; j < num_cups; j++){ char c = 0; #if INPUT_FROM_FILE ifs >> c; #else std::cin >> c; #endif tray[i].push_back(c - '0'); } } //??¢?´¢ { int num_move =std::min(f_A(tray[0], tray[1], tray[2]), f_C(tray[0], tray[1], tray[2])); if(num_move <= m){ std::cout << num_move << std::endl; } else{ std::cout << -1 << std::endl; } } } return 0; }
a.cc: In function 'int f_A(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:36:61: error: 'pow' was not declared in this scope 36 | return f_C(stack_A, stack_B, stack_C) + int(pow(3, n)); | ^~~ a.cc:43:65: error: 'pow' was not declared in this scope 43 | return f_A(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); | ^~~ a.cc: In function 'int f_B(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:64:62: error: 'pow' was not declared in this scope 64 | return f_C(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; | ^~~ a.cc:75:62: error: 'pow' was not declared in this scope 75 | return f_A(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; | ^~~ a.cc: In function 'int f_C(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:96:65: error: 'pow' was not declared in this scope 96 | return f_C(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); | ^~~ a.cc:103:61: error: 'pow' was not declared in this scope 103 | return f_A(stack_A, stack_B, stack_C) + int(pow(3, n)); | ^~~
s335660794
p00426
C++
#include <iostream> #include <stack> #include <queue> #include <deque> #include <vector> #include <functional> #define INPUT_FROM_FILE (0) #if INPUT_FROM_FILE #include <fstream> #endif const char Max_n = 15; int f_A(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_B(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_C(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_A(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_B.empty() && stack_C.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ stack_A.pop_front(); return f_A(stack_A, stack_B, stack_C); } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ int n = 0; stack_B.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + int(pow(3, n)); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ int n = 0; stack_C.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); } std::cout << "error f_A" << std::endl; exit(0); return 0; } int f_B(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_A.empty() && stack_C.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ int n = 0; stack_A.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ stack_B.pop_front(); return f_B(stack_A, stack_B, stack_C); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ int n = 0; stack_C.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; } std::cout << "error f_B" << std::endl; exit(0); return 0; } int f_C(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_A.empty() && stack_B.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ int n = 0; stack_A.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ int n = 0; stack_B.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + int(pow(3, n)); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ stack_C.pop_front(); return f_C(stack_A, stack_B, stack_C); } std::cout << "error f_C" << std::endl; exit(0); return 0; } int main(int argc, char **argv){ #if INPUT_FROM_FILE std::ifstream ifs("test.txt"); #endif int n = 0; int m = 0; #if INPUT_FROM_FILE while(ifs >> n >> m, (n != 0 || m != 0)){ #else while(std::cin >> n >> m, (n != 0 || m != 0)){ #endif std::deque<char> tray[3]; for(int i = 0; i < 3; i++){ int num_cups = 0; #if INPUT_FROM_FILE ifs >> num_cups; #else std::cin >> num_cups; #endif for(int j = 0; j < num_cups; j++){ char c = 0; #if INPUT_FROM_FILE ifs >> c; #else std::cin >> c; #endif tray[i].push_back(c - '0'); } } //??¢?´¢ { int num_move =std::min(f_A(tray[0], tray[1], tray[2]), f_C(tray[0], tray[1], tray[2])); if(num_move <= m){ std::cout << num_move << std::endl; } else{ std::cout << -1 << std::endl; } } } return 0; }
a.cc: In function 'int f_A(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:36:61: error: 'pow' was not declared in this scope 36 | return f_C(stack_A, stack_B, stack_C) + int(pow(3, n)); | ^~~ a.cc:43:65: error: 'pow' was not declared in this scope 43 | return f_A(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); | ^~~ a.cc: In function 'int f_B(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:64:62: error: 'pow' was not declared in this scope 64 | return f_C(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; | ^~~ a.cc:75:62: error: 'pow' was not declared in this scope 75 | return f_A(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; | ^~~ a.cc: In function 'int f_C(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:96:65: error: 'pow' was not declared in this scope 96 | return f_C(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); | ^~~ a.cc:103:61: error: 'pow' was not declared in this scope 103 | return f_A(stack_A, stack_B, stack_C) + int(pow(3, n)); | ^~~
s556607986
p00426
C++
#include <iostream> #include <stack> #include <queue> #include <deque> #include <vector> #include <functional> #define INPUT_FROM_FILE (0) #if INPUT_FROM_FILE #include <fstream> #endif const char Max_n = 15; int f_A(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_B(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_C(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C); int f_A(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_B.empty() && stack_C.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ stack_A.pop_front(); return f_A(stack_A, stack_B, stack_C); } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ int n = 0; stack_B.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + int(pow(3, n)); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ int n = 0; stack_C.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); } //std::cout << "error f_A" << std::endl; //exit(0); return 0; } int f_B(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_A.empty() && stack_C.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ int n = 0; stack_A.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ stack_B.pop_front(); return f_B(stack_A, stack_B, stack_C); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ int n = 0; stack_C.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; } //std::cout << "error f_B" << std::endl; //exit(0); return 0; } int f_C(std::deque<char> stack_A, std::deque<char> stack_B, std::deque<char> stack_C){ if(stack_A.empty() && stack_B.empty()){ return 0; } char min_stack_A = !stack_A.empty() ? stack_A.front() : Max_n + 1; char min_stack_B = !stack_B.empty() ? stack_B.front() : Max_n + 1; char min_stack_C = !stack_C.empty() ? stack_C.front() : Max_n + 1; if(min_stack_A < min_stack_B && min_stack_A < min_stack_C){ int n = 0; stack_A.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_C(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); } if(min_stack_B < min_stack_A && min_stack_B < min_stack_C){ int n = 0; stack_B.pop_front(); n = stack_A.size() + stack_B.size() + stack_C.size(); return f_A(stack_A, stack_B, stack_C) + int(pow(3, n)); } if(min_stack_C < min_stack_A && min_stack_C < min_stack_B){ stack_C.pop_front(); return f_C(stack_A, stack_B, stack_C); } //std::cout << "error f_C" << std::endl; //exit(0); return 0; } int main(int argc, char **argv){ #if INPUT_FROM_FILE std::ifstream ifs("test.txt"); #endif int n = 0; int m = 0; #if INPUT_FROM_FILE while(ifs >> n >> m, (n != 0 || m != 0)){ #else while(std::cin >> n >> m, (n != 0 || m != 0)){ #endif std::deque<char> tray[3]; for(int i = 0; i < 3; i++){ int num_cups = 0; #if INPUT_FROM_FILE ifs >> num_cups; #else std::cin >> num_cups; #endif for(int j = 0; j < num_cups; j++){ char c = 0; #if INPUT_FROM_FILE ifs >> c; #else std::cin >> c; #endif tray[i].push_back(c - '0'); } } //??¢?´¢ { int num_move =std::min(f_A(tray[0], tray[1], tray[2]), f_C(tray[0], tray[1], tray[2])); if(num_move <= m){ std::cout << num_move << std::endl; } else{ std::cout << -1 << std::endl; } } } return 0; }
a.cc: In function 'int f_A(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:36:61: error: 'pow' was not declared in this scope 36 | return f_C(stack_A, stack_B, stack_C) + int(pow(3, n)); | ^~~ a.cc:43:65: error: 'pow' was not declared in this scope 43 | return f_A(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); | ^~~ a.cc: In function 'int f_B(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:64:62: error: 'pow' was not declared in this scope 64 | return f_C(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; | ^~~ a.cc:75:62: error: 'pow' was not declared in this scope 75 | return f_A(stack_A, stack_B, stack_C) + (int(pow(3, n)) + 1) / 2; | ^~~ a.cc: In function 'int f_C(std::deque<char>, std::deque<char>, std::deque<char>)': a.cc:96:65: error: 'pow' was not declared in this scope 96 | return f_C(stack_A, stack_B, stack_C) + 2 * int(pow(3, n)); | ^~~ a.cc:103:61: error: 'pow' was not declared in this scope 103 | return f_A(stack_A, stack_B, stack_C) + int(pow(3, n)); | ^~~
s700138009
p00426
C++
???
a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??? | ^
s523510900
p00426
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s287209525
p00426
C++
#include<iostream> #include<algorithm> #include<vector> using namespace std; void input(vector<int> &); int main() { int n, m; vector<int> table; int point[] = { 0,2 }; int move[] = { 2,0,0 }; while (cin >> n >> m&&n != 0) { table.resize(n + 1); input(table); int ans = (1 << 31) - 1; int default = 1; for (int i = 1; i < n; ++i) { default *= 3; } for (int i = 0; i < 2; ++i) { int stock = default; int place = point[i]; int dnum = 0; for (int j = 1; j <= n; ++j) { if (abs(table[j]- place)==1) { dnum += stock; place = move[place]; } else if (abs(table[j] - place)==2) { dnum += stock * 2; } stock /= 3; } ans = min(ans, dnum); } cout << (ans <= m ? ans : -1) << endl; } return 0; } void input(vector<int > &table) { for (int i = 0; i < 3; ++i) { int time; cin >> time; for (int j = 0; j < time; ++j) { int num; cin >> num; table[num] = i; } } }
a.cc: In function 'int main()': a.cc:14:37: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow] 14 | int ans = (1 << 31) - 1; | ~~~~~~~~~~^~~ a.cc:15:21: error: expected unqualified-id before 'default' 15 | int default = 1; | ^~~~~~~ a.cc:17:25: error: case label not within a switch statement 17 | default *= 3; | ^~~~~~~ a.cc:17:32: error: expected ':' before '*=' token 17 | default *= 3; | ^~~ | : a.cc:17:33: error: expected primary-expression before '*=' token 17 | default *= 3; | ^~ a.cc:20:37: error: expected primary-expression before 'default' 20 | int stock = default; | ^~~~~~~
s435799516
p00426
C++
#include <cstdio> int nn = 1, an, bn, cn, a[20], b[20], c[20], total = 0, f = 1; struct mm{ char ch; int nu; }; struct mm m1, m2; int calculation(int min, int max){ if(min == max)return 0; if(min < max)int sum = calculation(++min, max) * 3 + 2; return sum; } int move(int flag){ int number; if(flag == 0){ number = an - m1.nu + 1; for(int i = 0;i < number;i++)c[++cn] = a[an--]; } if(flag == 1){ number = cn - m1.nu + 1; for(int i = 0;i < number;i++)a[++an] = c[cn--]; } calculation(0, number); return 0; } int sort(){ if(m1.ch == m2.ch)return 0; if(m2.ch == 'b'){ if(m1.ch == 'a')c[++cn] = b[bn--], move(0); //??? if(m1.ch == 'c')a[++an] = a[an--], move(1); //??? } return 0; } int solve(int max){ for(int i = 0;i < an;i++){ if(a[i] == max)m1.ch = 'a',m1.nu = i; if(a[i] == max - 1)m2.ch = 'a', m2.nu = i; } for(int i = 0;i < bn;i++){ if(b[i] == max)m1.ch = 'b',m1.nu = i; if(b[i] == max - 1)m2.ch = 'b', m2.nu = i; } for(int i = 0;i < cn;i++){ if(c[i] == max)m1.ch = 'c',m1.nu = i; if(c[i] == max - 1)m2.ch = 'c', m2.nu = i; } if(f == 1 && m1.nu == bn){ if(m2.ch == 'a'){ a[++an] = b[bn--]; }else if(m2.ch == 'c'){ c[++cn] = b[bn--]; } }else{ sort(); } return 0; } int main(){ int n, m, max; int a[20], b[20], c[20]; scanf("%d %d",&n, &m); scanf("%d", &an); for(int i = 0;i < an;i++){ scanf("%d", &a[i]); if(a[i] > max)max = a[i]; } scanf("%d", &bn); for(int i = 0;i < bn;i++){ scanf("%d", &b[i]); if(b[i] > max)max = b[i]; } scanf("%d", &cn); for(int i = 0;i < cn;i++){ scanf("%d", &c[i]); if(c[i] > max)max = c[i]; } solve(max); printf("%d %d",n, m); return 0; }
a.cc: In function 'int calculation(int, int)': a.cc:15:16: error: 'sum' was not declared in this scope 15 | return sum; | ^~~
s891729656
p00426
C++
#include<stdio.h> int main(void){ int n, m, a[1000], b[10000][1000] = { 0 }; scanf("%d %d", &n, &m); while ( 1 ) { for ( i = 0; i < n; i++ ) { scanf("%d", &a[i]); for ( j = 0; j < a[i]; j++ ) { scanf("%d", &b[i][j]); } } for ( i = 0; i < m; i++ ) { for ( j = 0; j < n; i++ ) { for ( x = ) } } scanf("%d %d", &n, &m); if ( n == 0 && m == 0 ) break; } return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: 'i' was not declared in this scope 6 | for ( i = 0; i < n; i++ ) { | ^ a.cc:8:19: error: 'j' was not declared in this scope 8 | for ( j = 0; j < a[i]; j++ ) { | ^ a.cc:12:15: error: 'i' was not declared in this scope 12 | for ( i = 0; i < m; i++ ) { | ^ a.cc:13:19: error: 'j' was not declared in this scope 13 | for ( j = 0; j < n; i++ ) { | ^ a.cc:14:23: error: 'x' was not declared in this scope 14 | for ( x = ) | ^ a.cc:14:27: error: expected primary-expression before ')' token 14 | for ( x = ) | ^ a.cc:15:13: error: expected primary-expression before '}' token 15 | } | ^ a.cc:14:28: error: expected ';' before '}' token 14 | for ( x = ) | ^ | ; 15 | } | ~ a.cc:15:13: error: expected primary-expression before '}' token 15 | } | ^ a.cc:14:28: error: expected ')' before '}' token 14 | for ( x = ) | ~ ^ | ) 15 | } | ~ a.cc:15:13: error: expected primary-expression before '}' token 15 | } | ^
s258982510
p00426
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <iterator> #include <list> #include <map> #include <queue> #include <fstream> using namespace std; int main() { int N, M, K; while(cin>>N>>M && (N || M)){ //i”Ԗڂɑ傫‚¢’l‚ª‚ǂ̃gƒŒƒC‚É‚¨‚¢‚Ä‚ ‚é‚© vector<int> v(N+1); for(int i = 0; i < 3; i++){ cin>>K; for(int j = 0; j < K; j++){ int tmp; cin>>tmp; v[tmp] = i; } } vector<int> a(N+1), c(N+1); a[N] = v[N]; c[N] = 2 - v[N]; for(int i = N; i > 1; i--) { switch(v[i-1]) { case 0: a[i-1] = a[i]; c[i-1] = c[i] + 2 * pow(3.0, N-i+1); break; case 1: a[i-1] = c[i] + pow(3.0, N-i+1); c[i-1] = a[i] + pow(3.0, N-i+1); break; case 2: a[i-1] = a[i] + 2 * pow(3.0, N-i+1); c[i-1] = c[i]; break; } } int res = min(a[1], c[1]); if(M < res) res = -1; cout << res << endl; } }
a.cc: In function 'int main()': a.cc:40:53: error: 'pow' was not declared in this scope 40 | c[i-1] = c[i] + 2 * pow(3.0, N-i+1); | ^~~
s580308503
p00426
C++
#define _USE_MATH_DEFINES #define INF 10000000 #include <iostream> #include <sstream> #include <cmath> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> using namespace std; typedef long long ll; typedef pair <int,vector<int> > P; typedef pair <int,P> PP; typedef pair <int,PP> PPP; static const double eps = 1e-8; int bfs(int m,vector<int>& sets, map<vector<int>,int>& visited){ priority_queue<P,vector<P>,greater<P> > que; que.push(P(0,sets)); visited[sets] = 0; vector<int> sets; vector<int> tmp; while(!que.empty()){ int cost = que.top().first; sets = que.top().second; if(sets[1]==0 && sets[2]==0) return cost; if(sets[0]==0 && sets[1]==0) return cost; if(cost >= m) break; que.pop(); for(int i=0;i+1<sets.size();i++){ if((sets[i] && sets[i+1] && sets[i] < sets[i+1]) || (!sets[i] && sets[i+1])){ tmp = sets; int pos=0; for(int j=15;j>=0;j--){ if(tmp[i+1] & (1<<j)){ pos = j; break; } } tmp[i+1] &= ~(1<<pos); tmp[i] |= (1<<pos); if(visited.find(tmp) == visited.end()){ visited[tmp] = cost + 1; que.push(P(cost+1,tmp)); } } else if((sets[i] && sets[i+1] && sets[i] > sets[i+1]) || (sets[i] && !sets[i+1])){ tmp = sets; int pos=0; for(int j=15;j>=0;j--){ if(tmp[i] & (1<<j)){ pos = j; break; } } tmp[i] &= ~(1<<pos); tmp[i+1] |= (1<<pos); if(visited.find(tmp) == visited.end()){ visited[tmp] = cost + 1; que.push(P(cost+1,tmp)); } } } } return -1; } int main(){ int n,m; while(~scanf("%d %d",&n,&m)){ if(n==m && m==0) break; vector<int> sets(3); map<vector<int>,int> visited; for(int i=0;i<3;i++){ int amount; scanf("%d",&amount); for(int j=0;j<amount;j++){ int size; scanf("%d",&size); sets[i] |= (1<<(size-1)); } } printf("%d\n",bfs(m,sets,visited)); } }
a.cc: In function 'int bfs(int, std::vector<int>&, std::map<std::vector<int>, int>&)': a.cc:33:21: error: declaration of 'std::vector<int> sets' shadows a parameter 33 | vector<int> sets; | ^~~~ a.cc:27:28: note: 'std::vector<int>& sets' previously declared here 27 | int bfs(int m,vector<int>& sets, map<vector<int>,int>& visited){ | ~~~~~~~~~~~~~^~~~
s898698091
p00426
C++
#define _USE_MATH_DEFINES #define INF 10000000 #include <iostream> #include <sstream> #include <cmath> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #include <hash_map> using namespace std; typedef long long ll; typedef pair <int,vector<int> > P; static const double eps = 1e-8; int bfs(int m,vector<int>& root, hash_map<string,int> visited){ priority_queue<P,vector<P>,greater<P> > que; que.push(P(0,root)); vector<int> tmp; vector<int> sets; while(!que.empty()){ int cost = que.top().first; sets = que.top().second; if(sets[1]==0 && sets[2]==0) return cost; if(sets[0]==0 && sets[1]==0) return cost; if(cost >= m) break; que.pop(); for(int i=0;i+1<sets.size();i++){ if((sets[i] && sets[i+1] && sets[i] < sets[i+1]) || (!sets[i] && sets[i+1])){ tmp = sets; int pos=0; for(int j=15;j>=0;j--){ if(tmp[i+1] & (1<<j)){ pos = j; break; } } tmp[i+1] &= ~(1<<pos); tmp[i] |= (1<<pos); char buf[32]; sprintf(buf,"%09d%09d%09d",tmp[0],tmp[1],tmp[2]); string next; next = buf; if(visited.find(next) == visited.end()){ visited[next] = cost+1; que.push(P(cost+1,tmp)); } } else if((sets[i] && sets[i+1] && sets[i] > sets[i+1]) || (sets[i] && !sets[i+1])){ tmp = sets; int pos=0; for(int j=15;j>=0;j--){ if(tmp[i] & (1<<j)){ pos = j; break; } } tmp[i] &= ~(1<<pos); tmp[i+1] |= (1<<pos); char buf[32]; sprintf(buf,"%09d%09d%09d",tmp[0],tmp[1],tmp[2]); string next; next = buf; if(visited.find(next) == visited.end()){ visited[next] = cost+1; que.push(P(cost+1,tmp)); } } } } return -1; } int main(){ int n,m; while(~scanf("%d %d",&n,&m)){ if(n==m && m==0) break; vector<int> sets(3); hash_map<string,int> visited; for(int i=0;i<3;i++){ int amount; scanf("%d",&amount); for(int j=0;j<amount;j++){ int size; scanf("%d",&size); sets[i] |= (1<<(size-1)); } } printf("%d\n",bfs(m,sets,visited)); } }
In file included from /usr/include/c++/14/backward/hash_map:60, from a.cc:17: /usr/include/c++/14/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp] 32 | #warning \ | ^~~~~~~ a.cc:26:34: error: 'hash_map' has not been declared 26 | int bfs(int m,vector<int>& root, hash_map<string,int> visited){ | ^~~~~~~~ a.cc:26:42: error: expected ',' or '...' before '<' token 26 | int bfs(int m,vector<int>& root, hash_map<string,int> visited){ | ^ a.cc: In function 'int bfs(int, std::vector<int>&, int)': a.cc:63:36: error: 'visited' was not declared in this scope 63 | if(visited.find(next) == visited.end()){ | ^~~~~~~ a.cc:87:36: error: 'visited' was not declared in this scope 87 | if(visited.find(next) == visited.end()){ | ^~~~~~~ a.cc: In function 'int main()': a.cc:103:17: error: 'hash_map' was not declared in this scope; did you mean '__gnu_cxx::hash_map'? 103 | hash_map<string,int> visited; | ^~~~~~~~ | __gnu_cxx::hash_map /usr/include/c++/14/backward/hash_map:83:11: note: '__gnu_cxx::hash_map' declared here 83 | class hash_map | ^~~~~~~~ a.cc:103:32: error: expected primary-expression before ',' token 103 | hash_map<string,int> visited; | ^ a.cc:103:33: error: expected primary-expression before 'int' 103 | hash_map<string,int> visited; | ^~~ a.cc:114:42: error: 'visited' was not declared in this scope 114 | printf("%d\n",bfs(m,sets,visited)); | ^~~~~~~
s288772278
p00426
C++
#include <iostream> #include <math> #define step(n) pow(3,x-n+1)/2 using namespace std; int x,hanoi[16]; int move(int s,int d,int c){ if(abs(s-d)==2) return move(s,1,c)+move(1,d,c); if(c==x) return abs(s-d); if(s==d) return move(hanoi[c+1], s, c+1); for(int i=c+1;i<=x;i++)if(hanoi[i]==s || hanoi[i]==d)return step(c) + move(hanoi[c+1], d, c+1); return 1 + move(hanoi[c+1], d, c+1); } int main(){ int i,n,m,t,r1,r2; while(cin>>x>>n,n){ for(i=0;i<3;i++)for(cin>>m;m--;hanoi[t]=i)cin>>t; r1=move(hanoi[1],0,1); r2=move(hanoi[1],2,1); if(n<r1&&n<r2) r1=-1; cout << min(r1,r2) << endl; } }
a.cc:2:10: fatal error: math: No such file or directory 2 | #include <math> | ^~~~~~ compilation terminated.
s310593509
p00426
C++
#include <iostream> #include <tuple> #include <map> #include <climit> using namespace std; const int NONE = INT_MAX; typedef tuple<int, int, int> Tuple; map<Tuple, int> S; Tuple goal; int n, m; int get_last( int m ) { for ( int i = n - 1; i >= 0; -- i ) { if ( ( m & ( 1 << i ) ) == ( 1 << i ) ) return 1 << i; } return 0; } int remove_last( int m ) { for ( int i = n - 1; i >= 0; -- i ) { if ( ( m & ( 1 << i ) ) == ( 1 << i ) ) return m ^ ( 1 << i ); } return m; } int solve( int A, int B, int C, int turns ) { Tuple tuple = make_tuple( A, B, C ); if ( S.count( tuple ) > 0 && turns >= S[tuple] ) return -1; S[tuple] = turns; if ( turns > m ) return -1; if ( tuple == goal ) return turns; if ( A != 0 ) { int u = get_last(A); int v = get_last(B); if ( u > v ) { int ret = solve( remove_last( A ), B | u, C, turns + 1 ); if ( ret != NONE ) return ret; } } if ( B != 0 ) { int u = get_last(B); int v = get_last(A); if ( u > v ) { int ret = solve( A | u, remove_last(B), C, turns + 1 ); if ( ret != NONE ) return ret; } } if ( B != 0 ) { int u = get_last(B); int v = get_last(C); if ( u > v ) { int ret = solve( A, remove_last(B), C | u, turns + 1 ); if ( ret != NONE ) return ret; } } if ( C != 0 ) { int u = get_last(C); int v = get_last(B); if ( u > v ) { int ret = solve( A, B | u, remove_last(C), turns + 1 ); if ( ret != NONE ) return ret; } } return -1; } int main() { while ( cin >> n >> m ) { if ( n == 0 && m == 0 ) break; S.clear(); int T[3] = { 0, 0, 0 }; for ( int i = 0; i < 3; ++ i ) { int k; cin >> k; for ( int j = 0; j < k; ++ j ) { int t; cin >> t; t--; T[i] |= 1 << t; } } goal = make_tuple( T[0], T[1], T[2] ); int ret1 = solve( (1<<n)-1, 0, 0, 0 ); int ret2 = solve( 0, 0, (1<<n)-1, 0 ); int res = min( ret1, ret2 ); if ( res == NONE ) res = -1; } return 0; }
a.cc:4:10: fatal error: climit: No such file or directory 4 | #include <climit> | ^~~~~~~~ compilation terminated.
s872394756
p00426
C++
#include <iostream> #include <math.h> #define S(n) (int)(pow(3,x-(n)+1)/2) using namespace std; int main(){ int h[17],a[17],c[17],x,i,n,m; while(cin>>x>>n,n){ for(i=0;i<3;i++)for(cin>>m;m--;h[t]=i)cin>>t; a[x]=h[x];c[x]=2-h[x]; for(i=x;i>1;i--){ if(h[i-1]==0){ a[i-1]=a[i]; c[i-1]=c[i]+2+4*S(i); }else if(h[i-1]==1){ a[i-1]=c[i]+1+2*S(i); c[i-1]=a[i]+1+2*S(i); }else{ a[i-1]=a[i]+2+4*S(i); c[i-1]=c[i]; } } t=min(a[1],c[1]); cout<<t>n?-1:t<<endl; } }
a.cc: In function 'int main()': a.cc:9:50: error: 't' was not declared in this scope 9 | for(i=0;i<3;i++)for(cin>>m;m--;h[t]=i)cin>>t; | ^ a.cc:23:17: error: 't' was not declared in this scope 23 | t=min(a[1],c[1]); | ^
s636455771
p00426
C++
#include <iostream> #include <math.h> #define S(n) (int)(pow(3,x-(n)+1)/2) using namespace std; int main(){ int h[17],a[17],c[17],x,i,n,m,t; while(cin>>x>>n,n){ for(i=0;i<3;i++)for(cin>>m;m--;h[t]=i)cin>>t; a[x]=h[x];c[x]=2-h[x]; for(i=x;i>1;i--){ if(h[i-1]==0){ a[i-1]=a[i]; c[i-1]=c[i]+2+4*S(i); }else if(h[i-1]==1){ a[i-1]=c[i]+1+2*S(i); c[i-1]=a[i]+1+2*S(i); }else{ a[i-1]=a[i]+2+4*S(i); c[i-1]=c[i]; } } t=min(a[1],c[1]); cout<<t>n?-1:t<<endl; } }
a.cc: In function 'int main()': a.cc:24:24: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int') 24 | cout<<t>n?-1:t<<endl; | ~~~~~~~^~ | | | | | int | std::basic_ostream<char> a.cc:24:24: note: candidate: 'operator>(int, int)' (built-in) 24 | cout<<t>n?-1:t<<endl; | ~~~~~~~^~ a.cc:24:24: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 24 | cout<<t>n?-1:t<<endl; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 24 | cout<<t>n?-1:t<<endl; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:24:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 24 | cout<<t>n?-1:t<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:24:25: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 24 | cout<<t>n?-1:t<<endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:24:25: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>' 24 | cout<<t>n?-1:t<<endl; | ^ a.cc:24:31: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 24 | cout<<t>n?-1:t<<endl; | ~^~~~~~
s002391359
p00426
C++
#include<cstdio> #include<iostream> #include <stack> using namespace std; void main() { stack<int>a,b,c; while(1) { int count=0,n,m,check; scanf("%d %d",&n,&m); if(n==0 && m==0) { puts("-1"); break; } int A,B,C, kari; /*エラー対策*/ a.push(0); b.push(0); c.push(0); scanf("%d",&A); for(int i=0;i<A;i++){ scanf("%d",&kari); a.push(kari); } scanf("%d",&B); for(int i=0;i<B;i++){ scanf("%d",&kari); b.push(kari); } scanf("%d",&C); for(int i=0;i<C;i++){ scanf("%d",&kari); c.push(kari); } while(1) { if(b.top()==0 && c.top()==0) break; if(a.top()<b.top() && a.top()<c.top()){ kari=b.top(); a.push(kari); b.pop(); count++; continue; } if(b.top()<c.top() ){ kari=c.top(); b.push(kari); c.pop(); count++; continue; } if(b.top()<a.top()){ kari=a.top(); b.push(kari); a.pop(); count++; continue; } if(c.top()<b.top() && a.top()!=b.top()-1){ kari=b.top(); c.push(kari); b.pop(); count++; continue; } else{ kari=b.top(); a.push(kari); b.pop(); count++; continue; } } if(count<m || count==m) printf("\n%d\n",count); else printf("\n%d\n",-1); } }
a.cc:8:1: error: '::main' must return 'int' 8 | void main() | ^~~~
s062150697
p00426
C++
c[];main(n,m,i,j,k,f){for(f="%d\n";scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
a.cc:1:1: error: 'c' does not name a type 1 | c[];main(n,m,i,j,k,f){for(f="%d\n";scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^ a.cc:1:9: error: expected constructor, destructor, or type conversion before '(' token 1 | c[];main(n,m,i,j,k,f){for(f="%d\n";scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}} | ^
s074889354
p00426
C++
#include <iostream> #include <algorithm> #include <queue> #include <map> #include <vector> #include <cmath> using namespace std; const int MAXN = 17; const int SSIZE = 15000000; const int INF = INT_MAX; const int W = 3; int N, M; int three[MAXN]; bool vis[SSIZE]; void init() { three[0] = 1; for(int i = 1; i < MAXN; ++i) three[i] = three[i-1] * 3; } int get3(int s, int i) { return s/three[i]%3; } int getTop(int s, int pos) { int maxi = -1; for(int i = 0; i < N; ++i) { if(s % W == pos) maxi = i; s /= W; } return maxi; } int move(int s, int from, int to) { int a = getTop(s, from); int b = getTop(s, to); if(a == -1) return INF; if(a < b) return INF; s -= three[a] * from; s += three[a] * to; return s; } void show(int s) { for(int i = 0; i < N; ++i) { cout << s%3; s /= 3; } cout << endl; } int bfs(int s) { queue<pair<int, int> > que; fill(vis, vis+SSIZE, false); que.push(make_pair(s,0)); vis[s] = true; int goal1, goal2; goal1 = goal2 = 0; for(int i = 0; i < N; ++i) goal2 += three[i]*2; if(s == goal1 || s == goal2) { return 0; } while(!que.empty()) { s = que.front().first; int cost = que.front().second; que.pop(); if(cost == M) continue; for(int i = 0; i < W; ++i) { for(int j = 0; j < W; ++j) { if(abs(i-j) != 1) continue; int ns = move(s, i, j); if(ns == INF) continue; if(vis[ns]) continue; if(ns == goal1 || ns == goal2) { return cost+1; } vis[ns] = true; que.push(make_pair(ns, cost+1)); } } } return INF; } int main() { init(); while(cin >> N >> M && (N|M)) { int sum = 0; for(int i = 0; i < W; ++i) { int k; cin >> k; while(k--) { int a; cin >> a; --a; sum += three[a] * i; } } int ans = bfs(sum); if(ans <= M) { cout << ans << endl; } else { cout << -1 << endl; } } return 0; }
a.cc:11:17: error: 'INT_MAX' was not declared in this scope 11 | const int INF = INT_MAX; | ^~~~~~~ a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 6 | #include <cmath> +++ |+#include <climits> 7 | using namespace std;
s411123570
p00426
C++
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> using namespace std; int n, m; int ans; inline int msb(int x) { if(!x) return 0; return (1 << (31 - __builtin_clz(x))); } void dfs(vector<int> state, vector<int> prev, int cnt = 0) { if(cnt > min(m, ans)) return; if(state[0] == (1 << n) - 1 || state[2] == (1 << n) - 1) { ans = cnt; return; } for(int i = 0; i < 2; ++i) { int move = max(msb(state[i]), msb(state[i + 1])); vector<int> next = state; next[i] ^= move; next[i + 1] ^= move; if(next != state) dfs(next, state, cnt + 1); } } int main() { cin.tie(false); ios::sync_with_stdio(false); const vector<int> init(3, -1); for(; cin >> n >> m, n | m;) { vector<int> cup(3, 0); for(int i = 0; i < 3; ++i) { int num; cin >> num; for(int j = 0; j < num; ++j) { int size; cin >> size; --size; cup[i] |= (1 << size); } } ans = INT_MAX; dfs(cup, init); cout << (ans == INT_MAX ? -1 : ans) << endl; } return EXIT_SUCCESS; }
a.cc: In function 'int main()': a.cc:38:16: error: no matching function for call to 'std::basic_istream<char>::tie(bool)' 38 | cin.tie(false); | ~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]' 299 | tie() const | ^~~ /usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/14/bits/basic_ios.h:311:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]' 311 | tie(basic_ostream<_CharT, _Traits>* __tiestr) | ^~~ /usr/include/c++/14/bits/basic_ios.h:311:43: note: no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*' 311 | tie(basic_ostream<_CharT, _Traits>* __tiestr) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ a.cc:59:23: error: 'INT_MAX' was not declared in this scope 59 | ans = INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include <vector> +++ |+#include <climits> 5 | using namespace std;
s310402403
p00426
C++
#include <stdio.h> #include <stdbool.h> #define INF 15 #define A 0 #define B 1 #define C 2 char cond[INF]; char n; int m; int sum; void move(int pos, char dist) { char now = cond[pos]; if (now == dist) { return; } else if (abs(now-dist) == 2) { move(pos, B); move(pos, dist); } else { int i; char no_present = (dist+now == 1)?C: (dist+now == 2)?B: A; for (i=1;pos+i < n;i++){ if (cond[pos+i] == dist || cond[pos+i] == now) { move(pos+i, no_present); } } cond[pos] = dist; sum += 1; } return; } int main() { while (1) { int i; char dist; scanf("%d %d", &n, &m); if (n == 0 && m ==0) { break; } for (i=0;i < 3;i++) { int j,k; scanf("%d", &k); for (j=0;j < k;j++) { int tmp; scanf("%d", &tmp); cond[tmp-1] = i; } } dist = (cond[0] != B)?cond[0]:A; for (i=0;i < n;i++) { move(i, dist); } if (sum <= m) { printf("%d\n", sum); } else { printf("-1\n"); } } }
a.cc: In function 'void move(int, char)': a.cc:19:16: error: 'abs' was not declared in this scope 19 | } else if (abs(now-dist) == 2) { | ^~~
s633675766
p00426
C++
//E? Nanndatte? #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; typedef pair<int,int> P; typedef pair<int,P> P1; typedef pair<P,P> P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 2000000000 int rec(vector<int>state[3],int a,int b) { vector<int>_cur[3]; for(int i=0;i<3;i++) { _cur[i]=state[i]; } if(state[0].size()==a || state[2].size()==a) return 0; int s[3]; for(int i=0;i<3;i++) s[i]=_cur[i].size(); int val=INF; if(s[0]) { if(s[1] && _cur[1][s[1]-1]<_cur[0][s[0]-1]) { _cur[1].pb(_cur[0][s[0]-1]); _cur[0].pop_back(); s[1]++; s[0]--; val=min(val,rec(_cur[3],a,b-1)); } else if(s[1]) { _cur[0].pb(_cur[1][s[1]-1]); _cur[1].pop_back(); s[0]++; s[1]--; val=min(val,rec(_cur[3],a,b)); } } if(s[2]) { if(s[1] && _cur[1][s[1]-1]<_cur[2][s[2]-1]) { _cur[1].pb(_cur[2][s[2]-1]); _cur[2].pop_back(); s[1]++; s[2]--; val=min(val,rec(_cur[3],a,b)); } else if(s[1]) { _cur[2].pb(_cur[1][s[1]-1]); _cur[1].pop_back(); s[2]++; s[1]--; val=min(val,rec(_cur[3],a,b)); } } return val+1; } int main(){ int n,k; while(1) { cin >> n >> k; if(n+k==0) return 0; vector<int>cur[3]; for(int i=0;i<3;i++) { int f; cin >> f; cur[i].resize(0); for(int j=0;j<f;j++) { int d; cin >>d; cur[i].pb(d); } } int ans = rec(cur[3],n,k); if(ans>k) ans=-1; cout << ans << endl; } }
a.cc: In function 'int rec(std::vector<int>*, int, int)': a.cc:43:47: error: cannot convert 'std::vector<int>' to 'std::vector<int>*' 43 | val=min(val,rec(_cur[3],a,b-1)); | ~~~~~~^ | | | std::vector<int> a.cc:24:20: note: initializing argument 1 of 'int rec(std::vector<int>*, int, int)' 24 | int rec(vector<int>state[3],int a,int b) | ~~~~~~~~~~~^~~~~~~~ a.cc:51:47: error: cannot convert 'std::vector<int>' to 'std::vector<int>*' 51 | val=min(val,rec(_cur[3],a,b)); | ~~~~~~^ | | | std::vector<int> a.cc:24:20: note: initializing argument 1 of 'int rec(std::vector<int>*, int, int)' 24 | int rec(vector<int>state[3],int a,int b) | ~~~~~~~~~~~^~~~~~~~ a.cc:62:47: error: cannot convert 'std::vector<int>' to 'std::vector<int>*' 62 | val=min(val,rec(_cur[3],a,b)); | ~~~~~~^ | | | std::vector<int> a.cc:24:20: note: initializing argument 1 of 'int rec(std::vector<int>*, int, int)' 24 | int rec(vector<int>state[3],int a,int b) | ~~~~~~~~~~~^~~~~~~~ a.cc:70:47: error: cannot convert 'std::vector<int>' to 'std::vector<int>*' 70 | val=min(val,rec(_cur[3],a,b)); | ~~~~~~^ | | | std::vector<int> a.cc:24:20: note: initializing argument 1 of 'int rec(std::vector<int>*, int, int)' 24 | int rec(vector<int>state[3],int a,int b) | ~~~~~~~~~~~^~~~~~~~ a.cc: In function 'int main()': a.cc:94:36: error: cannot convert 'std::vector<int>' to 'std::vector<int>*' 94 | int ans = rec(cur[3],n,k); | ~~~~~^ | | | std::vector<int> a.cc:24:20: note: initializing argument 1 of 'int rec(std::vector<int>*, int, int)' 24 | int rec(vector<int>state[3],int a,int b) | ~~~~~~~~~~~^~~~~~~~