submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s700768391
p00069
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <cassert> #include <iostream> #include <cctype> #include <sstream> #include <string> #include <list> #include <vector> #include <queue> #include <set> #include <stack> #include <map> #include <utility> #include <numeric> #include <algorithm> #include <iterator> #include <bitset> #include <complex> #include <fstream> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<int> vint; typedef pair<int, int> pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); } template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; } template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); } int n; bool reachble(vector<vint> str, int s, int e) { rep(i, str.size()) { if(s < n-1 && str[i][s]) s++; else if(0 < s && str[i][s-1]) s--; } return s == e; } int main() { while(cin >> n && n) { int m, g, d; cin >> m >> g >> d; m--; g--; vector<vint> stair(d, n-1); rep(i, d) { string bln; cin >> bln; rep(j, n) stair[i][j] = bln[j] - '0'; } if(reachble(stair, m, g)) cout << 0 << endl; else { rep(i, d) rep(j, n-1) { if(!stair[i][j]) { stair[i][j] = 1; if(reachble(stair, m, g)) { cout << i + 1 << " " << j + 1 << endl; goto ng; } stair[i][j] = 0; } } cout << 1 << endl; ng:; } } }
a.cc: In function 'int main()': a.cc:59:34: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int)' 59 | vector<vint> stair(d, n-1); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:12: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_algobase.h:65, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:4: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s547167537
p00069
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <cassert> #include <iostream> #include <cctype> #include <sstream> #include <string> #include <list> #include <vector> #include <queue> #include <set> #include <stack> #include <map> #include <utility> #include <numeric> #include <algorithm> #include <iterator> #include <bitset> #include <complex> #include <fstream> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<int> vint; typedef pair<int, int> pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); } template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; } template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); } int n; bool reachble(vector<vint> str, int s, int e) { rep(i, str.size()) { if(s < n-1 && str[i][s]) s++; else if(0 < s && str[i][s-1]) s--; } return s == e; } int main() { while(cin >> n && n) { int m, g, d; cin >> m >> g >> d; m--; g--; vector<vint> stair(d, n-1); rep(i, d) { string bln; cin >> bln; rep(j, n) stair[i][j] = bln[j] - '0'; } if(reachble(stair, m, g)) cout << 0 << endl; else { bool flag = false; rep(i, d) { rep(j, n-1) { if(!stair[i][j]) { stair[i][j] = 1; if(reachble(stair, m, g)) { cout << i + 1 << " " << j + 1 << endl; flag = true; break; } stair[i][j] = 0; } } if(flag) break; } if(!flag) cout << 1 << endl; } } }
a.cc: In function 'int main()': a.cc:59:34: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int)' 59 | vector<vint> stair(d, n-1); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:12: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_algobase.h:65, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:4: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s521744520
p00069
C++
#include <iostream> #include <cmath> #include <cstring> using namespace std; void charAnd(char *a, char *b, char *r, int n){ for(int i=0; i<n; ++i){ if(a[i]=='1' && b[i]=='1'){ r[i]='1'; }else{ r[i]='0'; } } } void charOr(char *a, char *b, char *r, int n){ for(int i=0; i<n; ++i){ if(a[i]=='1' || b[i]=='1'){ r[i]='1'; }else{ r[i]='0'; } } } //0069 int main(){ int n,pos,p_pos,stages; int zero; cin >> n; cin >> pos; --pos; cin >> p_pos; --p_pos; cin >> stages; char own[30][10]; memset(own, '0',sizeof(own)); char prize[30][10]; memset(prize, '0',sizeof(prize)); char net[30][10]; memset(net, '0',sizeof(net)); for(int i=0; i<stages; ++i){ cin >> net[i]; own[i][n]='\0'; if(pos==0){ if(net[i][pos]=='1'){ own[i][pos+1]='1'; ++pos; }else{ own[i][p_pos]='1'; } }else{ if(net[i][pos-1]=='1'){ own[i][pos-1]='1'; --pos; }else if(net[i][pos]=='1'){ own[i][pos+1]='1'; ++pos; }else{ own[i][pos]='1'; } } } cin >> zero; if(zero!=0) cout << "error: input invalid" << endl; for(int i=stages; i>=0; --i){ prize[i][n]='\0'; if(p_pos==0){ if(net[i][p_pos]=='1'){ prize[i][p_pos+1]='1'; ++p_pos; }else{ prize[i][p_pos]='1'; } }else{ if(net[i][p_pos-1]=='1'){ prize[i][p_pos-1]='1'; --p_pos; }else if(net[i][p_pos]=='1'){ prize[i][p_pos+1]='1'; ++p_pos; }else{ prize[i][p_pos]='1'; } } } //経路が同一かをチェック bool isMatch = true; for(int i=0; i<stages; ++i){ int r = strcmp(own[i], prize[i]); if(r!=0){ isMatch = false; } } if(isMatch){ cout << "0" << endl; return 0; } //線の追加で当たりにたどれるか int stage, line; char cmp[9][2][11] = { {"1100000000","0100000000"}, {"0110000000","1010000000"}, {"0011000000","0101000000"}, {"0001100000","0010100000"}, {"0000110000","0001010000"}, {"0000011000","0000101000"}, {"0000001100","0000010100"}, {"0000000110","0000001010"}, {"0000000011","0000000010"}, }; for(stage=0; stage<stages; ++stage){ char or[11] = "0000000000"; charOr(own[stage], prize[stage], or, n); for(line=0; line<n-1; ++line){ //経路が隣あえば線の追加で当たりに到達する int r1 = strcmp(cmp[line][0], or); if(r1==0){ //線を追加しようとしている両隣に線がないか確認 char a[11] = "0000000000"; charAnd(net[stage], cmp[line][1], a, n-1); int r2 = strcmp("0000000000", a); if(r2==0){ cout << stage+1 << " " << line+1 << endl; return 0; } } } } cout << "1" << endl; return 0; }
a.cc: In function 'int main()': a.cc:123:22: error: expected unqualified-id before 'or' token 123 | char or[11] = "0000000000"; | ^~ a.cc:124:50: error: expected primary-expression before 'or' token 124 | charOr(own[stage], prize[stage], or, n); | ^~ a.cc:124:52: error: expected primary-expression before ',' token 124 | charOr(own[stage], prize[stage], or, n); | ^ a.cc:127:55: error: expected primary-expression before 'or' token 127 | int r1 = strcmp(cmp[line][0], or); | ^~ a.cc:127:57: error: expected primary-expression before ')' token 127 | int r1 = strcmp(cmp[line][0], or); | ^
s517960569
p00069
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int n,d; int a[10]={0,1,2,3,4,5,6,7,8,9}; char str[50][20]; void check(); int main(){ int m,s; for(;;){ cin>>n; if(n==0)exit(0); cin>>m>>s>>d; for(int i=1;i<=d;i++)cin>>str[i]; check(); if(a[s]==m)cout<<0<<endl; else { for(int i=1;i<=d;i++){ for(int j=0;j<n-1;j++){ if((j==n-2&&str[i][j]!='1'&&str[i][j-1]!='1')|| (j==0&&str[i][j]!='1'&&str[i][j+1]!='1')|| (j!=0&&j!=n-2&&str[i][j]!='1'&&str[i][j+1]!='1'&&str[i][j-1]!='1')){ str[i][j]='1'; check(); if(a[s]==m){ cout<<i<<" "<<j+1<<endl; goto end; } str[i][j]='0';              for(int k=0;k<10;k++)a[k]=k; } } } cout<<1<<endl; } end:; for(int i=0;i<10;i++)a[i]=i; for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; } return 0; } void check(){ for(int i=1;i<=d;i++){ for(int j=1;j<n;j++){ if(str[i][j-1]=='1')swap(a[j],a[j+1]); } } return; }
a.cc:31:1: error: extended character   is not valid in an identifier 31 |              for(int k=0;k<10;k++)a[k]=k; | ^ a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:31:31: error: expected primary-expression before 'int' 31 |              for(int k=0;k<10;k++)a[k]=k; | ^~~ a.cc:31:39: error: 'k' was not declared in this scope 31 |              for(int k=0;k<10;k++)a[k]=k; | ^
s830271383
p00069
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int n,d; int a[10]={0,1,2,3,4,5,6,7,8,9}; char str[50][20]; void check(); int main(){ int m,s; for(;;){ cin>>n; if(n==0)exit(0); cin>>m>>s>>d; for(int i=1;i<=d;i++)cin>>str[i]; check(); if(a[s]==m)cout<<0<<endl; else { for(int i=1;i<=d;i++){ for(int j=0;j<n-1;j++){ if((j==n-2&&str[i][j]!='1'&&str[i][j-1]!='1')|| (j==0&&str[i][j]!='1'&&str[i][j+1]!='1')|| (j!=0&&j!=n-2&&str[i][j]!='1'&&str[i][j+1]!='1'&&str[i][j-1]!='1')){ str[i][j]='1'; check(); if(a[s]==m){ cout<<i<<" "<<j+1<<endl; goto end; } str[i][j]='0'; for(int k=0;k<10;k++)a[k]=k; } } } cout<<1<<endl; } end:; for(int i=0;i<10;i++)a[i]=i; for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; } return 0; } void check(){ for(int i=1;i<=d;i++){ for(int j=1;j<n;j++){ if(str[i][j-1]=='1')swap(a[j],a[j+1]); } } return; } for(int i=1;i<=d;i++){ for(int j=0;j<n-1;j++){ if((j==n-2&&str[i][j]!='1'&&str[i][j-1]!='1')|| (j==0&&str[i][j]!='1'&&str[i][j+1]!='1')|| (j!=0&&j!=n-2&&str[i][j]!='1'&&str[i][j+1]!='1'&&str[i][j-1]!='1')){ str[i][j]='1'; check(); if(a[s]==m){ cout<<i<<" "<<j+1<<endl; goto end; } str[i][j]='0';              for(int k=0;k<10;k++)a[k]=k; } } } cout<<1<<endl; } end:; for(int i=0;i<10;i++)a[i]=i; for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; } return 0; } void check(){ for(int i=1;i<=d;i++){ for(int j=1;j<n;j++){ if(str[i][j-1]=='1')swap(a[j],a[j+1]); } } return; }
a.cc:64:1: error: extended character   is not valid in an identifier 64 |              for(int k=0;k<10;k++)a[k]=k; | ^ a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:52:13: error: expected unqualified-id before 'for' 52 | for(int i=1;i<=d;i++){ | ^~~ a.cc:52:25: error: 'i' does not name a type 52 | for(int i=1;i<=d;i++){ | ^ a.cc:52:30: error: 'i' does not name a type 52 | for(int i=1;i<=d;i++){ | ^ a.cc:68:13: error: 'cout' does not name a type 68 | cout<<1<<endl; | ^~~~ a.cc:69:9: error: expected declaration before '}' token 69 | } | ^ a.cc:70:9: error: 'end' does not name a type 70 | end:; | ^~~ a.cc:71:9: error: expected unqualified-id before 'for' 71 | for(int i=0;i<10;i++)a[i]=i; | ^~~ a.cc:71:21: error: 'i' does not name a type 71 | for(int i=0;i<10;i++)a[i]=i; | ^ a.cc:71:26: error: 'i' does not name a type 71 | for(int i=0;i<10;i++)a[i]=i; | ^ a.cc:72:9: error: expected unqualified-id before 'for' 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^~~ a.cc:72:21: error: 'i' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:72:26: error: 'i' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:72:42: error: 'j' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:72:47: error: 'j' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:73:5: error: expected declaration before '}' token 73 | } | ^ a.cc:74:5: error: expected unqualified-id before 'return' 74 | return 0; | ^~~~~~ a.cc:75:1: error: expected declaration before '}' token 75 | } | ^ a.cc:76:6: error: redefinition of 'void check()' 76 | void check(){ | ^~~~~ a.cc:43:6: note: 'void check()' previously defined here 43 | void check(){ | ^~~~~
s624436946
p00069
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int n,d; int a[10]={0,1,2,3,4,5,6,7,8,9}; char str[50][20]; void check(); int main(){ int m,s; for(;;){ cin>>n; if(n==0)exit(0); cin>>m>>s>>d; for(int i=1;i<=d;i++)cin>>str[i]; check(); if(a[s]==m)cout<<0<<endl; else { for(int i=1;i<=d;i++){ for(int j=0;j<n-1;j++){ if((j==n-2&&str[i][j]!='1'&&str[i][j-1]!='1')|| (j==0&&str[i][j]!='1'&&str[i][j+1]!='1')|| (j!=0&&j!=n-2&&str[i][j]!='1'&&str[i][j+1]!='1'&&str[i][j-1]!='1')){ str[i][j]='1'; check(); if(a[s]==m){ cout<<i<<" "<<j+1<<endl; goto end; } str[i][j]='0'; for(int k=0;k<10;k++)a[k]=k; } } } cout<<1<<endl; } end:; for(int i=0;i<10;i++)a[i]=i; for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; } return 0; } void check(){ for(int i=1;i<=d;i++){ for(int j=1;j<n;j++){ if(str[i][j-1]=='1')swap(a[j],a[j+1]); } } return; } for(int i=1;i<=d;i++){ for(int j=0;j<n-1;j++){ if((j==n-2&&str[i][j]!='1'&&str[i][j-1]!='1')|| (j==0&&str[i][j]!='1'&&str[i][j+1]!='1')|| (j!=0&&j!=n-2&&str[i][j]!='1'&&str[i][j+1]!='1'&&str[i][j-1]!='1')){ str[i][j]='1'; check(); if(a[s]==m){ cout<<i<<" "<<j+1<<endl; goto end; } str[i][j]='0';              for(int k=0;k<10;k++)a[k]=k; } } } cout<<1<<endl; } end:; for(int i=0;i<10;i++)a[i]=i; for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; } return 0; } void check(){ for(int i=1;i<=d;i++){ for(int j=1;j<n;j++){ if(str[i][j-1]=='1')swap(a[j],a[j+1]); } } return; }
a.cc:64:1: error: extended character   is not valid in an identifier 64 |              for(int k=0;k<10;k++)a[k]=k; | ^ a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:64:1: error: extended character   is not valid in an identifier a.cc:52:13: error: expected unqualified-id before 'for' 52 | for(int i=1;i<=d;i++){ | ^~~ a.cc:52:25: error: 'i' does not name a type 52 | for(int i=1;i<=d;i++){ | ^ a.cc:52:30: error: 'i' does not name a type 52 | for(int i=1;i<=d;i++){ | ^ a.cc:68:13: error: 'cout' does not name a type 68 | cout<<1<<endl; | ^~~~ a.cc:69:9: error: expected declaration before '}' token 69 | } | ^ a.cc:70:9: error: 'end' does not name a type 70 | end:; | ^~~ a.cc:71:9: error: expected unqualified-id before 'for' 71 | for(int i=0;i<10;i++)a[i]=i; | ^~~ a.cc:71:21: error: 'i' does not name a type 71 | for(int i=0;i<10;i++)a[i]=i; | ^ a.cc:71:26: error: 'i' does not name a type 71 | for(int i=0;i<10;i++)a[i]=i; | ^ a.cc:72:9: error: expected unqualified-id before 'for' 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^~~ a.cc:72:21: error: 'i' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:72:26: error: 'i' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:72:42: error: 'j' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:72:47: error: 'j' does not name a type 72 | for(int i=0;i<50;i++)for(int j=0;j<20;j++)str[i][j]=0; | ^ a.cc:73:5: error: expected declaration before '}' token 73 | } | ^ a.cc:74:5: error: expected unqualified-id before 'return' 74 | return 0; | ^~~~~~ a.cc:75:1: error: expected declaration before '}' token 75 | } | ^ a.cc:76:6: error: redefinition of 'void check()' 76 | void check(){ | ^~~~~ a.cc:43:6: note: 'void check()' previously defined here 43 | void check(){ | ^~~~~
s133775101
p00069
C++
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.Math.*; public class Main { int INF = 1 << 28; //long INF = 1L << 62; double EPS = 1e-10; void run() { Scanner sc = new Scanner(System.in); for(;;) { int n = sc.nextInt(); if(n==0) break; int m=sc.nextInt()-1, c=sc.nextInt()-1, d=sc.nextInt(); int g[] = new int[n]; for(int i=0;i<n;i++) g[i] = i; HashSet<P> s = new HashSet<P>(); for(int i=0;i<d;i++) { int l = Integer.valueOf((new StringBuilder(sc.next()).reverse().toString()), 2) << 1; for(int j=1;j<=n-1;j++) { if(((l>>j)&1) == 1) { swap(g, j, j-1); } else if( ((l>>(j-1))&1) == 0 && ((l>>(j+1))&1) == 0 ){ s.add(new P(g[j], g[j-1], i, j)); // debug(g[j], g[j-1], i, j); } // debug(g); } } // for(P p: s) debug(p.v1, p.v2, p.x, p.y); // debug(g); if( g[c] == m ) System.out.println(0); else { int t = g[c]; if( t < m ) { int tmp = t; t = m; m = tmp; } boolean f = false; for(P p: s) { if( p.v1 == m && p.v2 == t ) { System.out.println((p.x+1) + " " + p.y); f = true; } } if(!f) System.out.println(1); } } } void swap(int[] s, int a, int b) { int tmp = s[a]; s[a] = s[b]; s[b] = tmp; } class P { int v1, v2; int x, y; P(int v1, int v2, int x, int y) { this.v1 = min(v1, v2); this.v2 = max(v1, v2); this.x = x; this.y = y; } public boolean equals(Object o) { if( o instanceof P) { return v1 == ((P)o).v1 && v2 == ((P)o).v2; } return false; } public int hashCode() { return v1*100 + v2; } } void debug(Object... os) { System.err.println(Arrays.deepToString(os)); } public static void main(String[] args) { new Main().run(); } }
a.cc:2:1: error: 'import' does not name a type 2 | import java.util.*; | ^~~~~~ 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.*; | ^~~~~~ 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 static java.util.Arrays.*; | ^~~~~~ 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 static java.util.Collections.*; | ^~~~~~ 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 static java.lang.Math.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Main { | ^~~~~~
s826603641
p00070
Java
import sun.jvm.hotspot.jdi.IntegerTypeImpl; import java.io.*; import java.util.*; public class Main { int[][][] memo; int solve(int n, int bits, int sum) { if (n == 0) { if (sum == 0) return 1; return 0; } if (sum > 330) return 0; if (sum < 0) return 0; if (memo[n][bits][sum] != -1) return memo[n][bits][sum]; int ans = 0; for (int i = 0; i < 10; ++i) { if (((bits >> i) & 1) != 0) { ans += solve(n - 1, bits & ~(1 << i), sum - i*(10 - Integer.bitCount(bits) + 1)); } } return memo[n][bits][sum] = ans; } void run() { memo = new int[11][1024][331]; for (int i = 0; i < 11; ++i) { for(int j = 0; j < 1024; ++j) { for (int k = 0; k < 331; ++k) { memo[i][j][k] = -1; } } } try { while (true) { int N = readInt(); int S = readInt(); sysout.println(solve(N, (1 << 10) - 1, S)); } } catch (NullPointerException e) { } } public static void main(String[] args) { new Main().run(); } // flush automatically iff you call `println` or `printf` or `format`. PrintWriter sysout = new PrintWriter(System.out, true); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer buffer = new StringTokenizer(""); String read() { if (!buffer.hasMoreTokens()) { try { buffer = new StringTokenizer(in.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return buffer.nextToken(); } int readInt() { return Integer.parseInt(read()); } long readLong() { return Long.parseLong(read()); } double readDouble() { return Double.parseDouble(read()); } String readLine() { buffer = new StringTokenizer(""); try { return in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } }
Main.java:1: error: package sun.jvm.hotspot.jdi does not exist import sun.jvm.hotspot.jdi.IntegerTypeImpl; ^ 1 error
s714358166
p00070
Java
import???java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; int[][] dp; boolean[] use; while((line=br.readLine())!=null){ String[] values=line.split(" "); int n=Integer.parseInt(values[0]); int s=Integer.parseInt(values[1]); dp=new int[11][331]; use=new boolean[10]; if(n>10||s>330){ System.out.println("0"); continue; } dfs(1,0,dp,use); } } private static void dfs(int depth,int sum,int[][] dp,boolean[] use){ dp[depth-1][sum]++; for(int i=0;i<=9;i++){ if(!use[i]){ use[i]=true; dfs(depth+1,sum+depth*i); use[i]=false; } } } }
Main.java:1: error: <identifier> expected import???java.io.*; ^ 1 error
s772837457
p00070
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; int[][] dp; boolean[] use; while((line=br.readLine())!=null){ String[] values=line.split(" "); int n=Integer.parseInt(values[0]); int s=Integer.parseInt(values[1]); dp=new int[11][331]; use=new boolean[10]; if(n>10||s>330){ System.out.println("0"); continue; } dfs(1,0,dp,use); } } private static void dfs(int depth,int sum,int[][] dp,boolean[] use){ dp[depth-1][sum]++; for(int i=0;i<=9;i++){ if(!use[i]){ use[i]=true; dfs(depth+1,sum+depth*i); use[i]=false; } } } }
Main.java:27: error: method dfs in class Main cannot be applied to given types; dfs(depth+1,sum+depth*i); ^ required: int,int,int[][],boolean[] found: int,int reason: actual and formal argument lists differ in length 1 error
s244709741
p00070
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; class Main { private static int terminal = 0; private static int numConsist = 0; public void nextFor(int iteration, List<Integer> array, int constant, int sum){ int tmpSum; List<Integer> tmpArray = null; for( int i = 0; i <array.size(); i++){ tmpArray.clear(); tmpSum = new Integer(sum); tmpArray = new ArrayList<Integer>(array); tmpSum += tmpArray.get(i) * (constant + 1); tmpArray.remove(i); if (tmpArray.size() != 0 && iteration > 1) nextFor(iteration -1, tmpArray, constant + 1, tmpSum); if((iteration == 1 && tmpSum == terminal) || (tmpArray.size() == 0 && tmpSum == terminal)){ numConsist++; } } } public static void main(String[] args){ CombinationOfNumberSequences cNS = new CombinationOfNumberSequences(); List<Integer> array = new ArrayList<Integer>(); for(int i = 0; i < 10; i++){ array.add(i); } Scanner input = new Scanner(System.in); while(input.hasNext()){ String[] paraSet = input.nextLine().split(" "); int iteration = Integer.parseInt(paraSet[0]); terminal = Integer.parseInt(paraSet[1]); numConsist = 0; cNS.nextFor(iteration, array, 0, 0); System.out.println(numConsist); } input.close(); } }
Main.java:15: warning: [removal] Integer(int) in Integer has been deprecated and marked for removal tmpSum = new Integer(sum); ^ Main.java:30: error: cannot find symbol CombinationOfNumberSequences cNS = new CombinationOfNumberSequences(); ^ symbol: class CombinationOfNumberSequences location: class Main Main.java:30: error: cannot find symbol CombinationOfNumberSequences cNS = new CombinationOfNumberSequences(); ^ symbol: class CombinationOfNumberSequences location: class Main 2 errors 1 warning
s904863926
p00070
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; class Main { private static int terminal = 0; private static int numConsist = 0; public void nextFor(int iteration, List<Byte> integerList, int constant, int sum){ for( int i = 0; i <integerList.size(); i++){ List<Byte> tmpIntegerList = new ArrayList<Byte>(integerList); sum += tmpIntegerList.get(i) * (constant + 1); tmpIntegerList.remove(i); if(sum >= terminal && (iteration > 1 || tmpIntegerList.size() > 0)){ tmpIntegerList.clear(); i = integerList.size(); } else { if (tmpIntegerList.size() != 0 && iteration > 1) nextFor(iteration -1, tmpIntegerList, constant + 1, sum); if((iteration == 1 && sum == terminal) || (tmpIntegerList.size() == 0 && sum == terminal)){ numConsist++; } } } } public static void main(String[] args){ Main cNS = new Main(); List<Byte> integerList = new ArrayList<Byte>(); for(short i = 0; i < 10; i++){ integerList.add(i); } Scanner input = new Scanner(System.in); while(input.hasNext()){ int iteration = input.nextInt(); terminal = input.nextInt(); if(iteration >= 1 && iteration <=10 && terminal >= 0 && terminal <= 330){ numConsist = 0; cNS.nextFor(iteration, integerList, 0, 0); System.out.println(numConsist); } else if(iteration >= 1 && iteration <=10 && terminal > 330 && terminal <= 10000){ System.out.println(0); } } input.close(); } }
Main.java:33: error: incompatible types: short cannot be converted to Byte integerList.add(i); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s242805918
p00070
Java
import java.util.Arrays; import java.util.Scanner; public class Main2 { static int n, s, count; static boolean[] already; public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNext()){ n = cin.nextInt(); s = cin.nextInt(); if(n>10){ System.out.println(0); continue; } count=0; already = new boolean[10]; int[] a =new int[n]; Arrays.fill(a, -1); dfs(0, 0); System.out.println(count); } } static void dfs(int depth, int sum){ if(sum > s){ return; } if(depth == n){ if(sum==s){ count++; } return; } for(int i = 0; i < 10;i++){ if(already[i]){ continue; } already[i]=true; int tmp = sum; sum += (depth+1)*i; dfs(depth+1, sum); sum = tmp; already[i]=false; } } static boolean is(int[] a){ int sum=0; for(int i = 0; i < a.length;i++){ if(a[i]>=0){ sum += a[i]*(i+1); } } return sum==s; } }
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s493525158
p00070
Java
import java.util.*; public class Main { int n, s, count; @SuppressWarnings("unchecked") ArrayDeque<Integer> q = new ArrayDeque(); void loop(int a, int b){ if(a==n){ if(b==s) count++; }else if(b<=s){ for(int i=0;i<10;i++){ if(q.contains(i)==false){ q.push(i); loop(a+1,b+(a+1)*i); q.pop(); } } } } void solve(){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ n = sc.nextInt(); s = sc.nextInt(); count = 0; q = new ArrayDeque(); if(n<11 && s<370) loop(0, 0); System.out.println(count); } } public static void main(String[] args) { new Main.solve(); } }
Main.java:38: error: cannot find symbol new Main.solve(); ^ symbol: class solve location: class Main Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s120197436
p00070
Java
package jp.ac.saburou.volume0.p70; import java.util.NoSuchElementException; import java.util.Scanner; public class P70 { static boolean[] used = new boolean[10]; public static void main(String[] args) { Scanner scan = new Scanner(System.in); while(true){ try{ int n = scan.nextInt(); int s = scan.nextInt(); System.out.println(solve(n, s)); }catch(NoSuchElementException e){ //DO NOTHING } } } private static int solve(int numRemained, int s){ if(s < 0) return 0; if(numRemained < 1){ if(s == 0) return 1; else return 0; } int c = 0; for(int i = 0; i < 10; i++){ if(used[i]) continue; used[i] = true; c += solve(numRemained - 1, s - numRemained * i); used[i] = false; } return c; } }
Main.java:6: error: class P70 is public, should be declared in a file named P70.java public class P70 { ^ 1 error
s026232863
p00070
C
#include<stdio.h> int n,c; void k(int s,int num[10]){ int i; for(i=0;i<10;i++){ if(num[i]==0&&s>=n*i){//1 s-=n*i; num[i]=1; n--;//2 if(n==0&&s==0){ c++; } else if(s>=0&&n>0){ k(s,num);//3 } num[i]=0; n++; s+=n*i;//4 } } } int main(){ int s; while(scanf("%d %d",&n,&s)!=EOF){ c=0; int num[10]={0}; lc=1; k(s,num); printf("%d\n",c); } return 0; }
main.c: In function 'main': main.c:27:5: error: 'lc' undeclared (first use in this function); did you mean 'c'? 27 | lc=1; | ^~ | c main.c:27:5: note: each undeclared identifier is reported only once for each function it appears in
s972342585
p00070
C
#include <cstdio> bool used[10]; int sum, ans, n, s, Min, Max; inline void A(int x){ if(x == 0){ if(sum == s) ans++; return; } int tmp = -x; for(int i = 9; i >= 0; i--){ tmp += x; if(used[i]) continue; used[i] = true; sum += tmp; A(x-1); sum -= tmp; used[i] = false; } } int main(){ while(scanf("%d%d", &n, &s) != EOF){ Min = 0, Max = 0; for(int i = n-1; i >= 0; i--) Max += (i+1)*(i+1); for(int i = n-1; i >= 0; i--) Min += (n-i)*(i+1); if(s > Max || s < Min){ printf("0\n"); continue; } ans = 0; sum = 0; for(int i = 9; i >= 0; i--) used[i] = false; A(n); printf("%d\n", ans); } }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s829562129
p00070
C
#include <cstdio> #include <algorithm> #define N 10 using namespace std; /** Application main entry point. */ int main ( int argc, char * argv[ ] ) { int n, s; int i; while ( scanf ( "%d%d", &n, &s ) == 2 ) { int d[ N ] = { 0 }; int c = 0; for ( i = 1; i <= n; ++i ) { d[ N - i ] = i; } do { int r = 0; for ( i = 0; i < N; ++i ) { r += i * d[ i ]; } c += !!( r == s ); } while ( next_permutation ( d, d + N ) ); printf ( "%d\n", c ); } return ( 0 ); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s495228575
p00070
C
/* AizuOnline A0070 Combination of Number Sequences */ #include <stdio.h> #define min(x,y) (((x)>(y))?(y):(x)) int used_list[10]; long int c_n_s(int n,int s,int used_list_ptr) { int i,j; long int sum,ret; /* printf("%d %d %d\n",n,s,used_list_ptr);*/ if(n==1) { for(i=0;i<used_list_ptr;i++) { if(s == used_list[i]) return(0); } if(s > 9) return(0); else { /*printf("*");*/ return(1); } } else { sum = 0; for(i=min(9,(int)(s/n));i>=0;i--) { {for(j=0;j<used_list_ptr;j++) if(i == used_list[j]) goto AAA; } used_list[used_list_ptr]=i; ret = c_n_s(n-1,s-i*n,used_list_ptr+1); if(ret == 0) goto BBB: sum += ret; AAA: ; } BBB: ; } return(sum); } main() { int n , s; long int ret; while(EOF != scanf("%d %d",&n,&s)) { ret = c_n_s (n,s,0); printf("%ld\n",ret); } return(0); }
main.c: In function 'c_n_s': main.c:45:21: error: expected ';' before ':' token 45 | goto BBB: | ^ | ; main.c: At top level: main.c:58:1: error: return type defaults to 'int' [-Wimplicit-int] 58 | main() | ^~~~
s044991929
p00070
C
u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);}
main.c:1:1: warning: data definition has no type or storage class 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'u' [-Wimplicit-int] main.c:1:6: error: return type defaults to 'int' [-Wimplicit-int] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^ main.c: In function 'D': main.c:1:6: error: type of 's' defaults to 'int' [-Wimplicit-int] main.c:1:6: error: type of 'v' defaults to 'int' [-Wimplicit-int] main.c:1:117: error: expected ':' before ';' token 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^ | : main.c: At top level: main.c:1:128: error: return type defaults to 'int' [-Wimplicit-int] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^~~~ main.c: In function 'main': main.c:1:128: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:128: error: type of 'v' defaults to 'int' [-Wimplicit-int] main.c:1:145: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} main.c:1:145: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^~~~~ main.c:1:145: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:165: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^~~~~~ main.c:1:165: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:165: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:165: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:187: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} main.c:1:187: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 1 | u[9];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);} | ^~~~ main.c:1:187: note: include '<stdlib.h>' or provide a declaration of 'exit'
s793926056
p00070
C
#include <stdio.h> int search(int, int, int, int[]); int main(void) { int i; int count; int isUsed[10]={0,0,0,0,0,0,0,0,0,0}; while(scanf("%d %d",&n, &s)!=EOF){ count=0; for(i=0; i<10; i++){ isUsed[i]=1; count+=search(s, n, i, isUsed); isUsed[i]=0; } printf("%d\n", count); } return 0; } int search(int remain, int n, int k, int isUsed[]) { int i; int count; remain-=n*k; if(remain<0) return 0; if(n==1 && remain==0) return 1; for(i=0; i<10; i++){ if(isUsed[i]==1) continue; isUsed[i]=1; count+=search(remain, n-1, i, isUsed); isUsed[i]=0; } return count; }
main.c: In function 'main': main.c:11:24: error: 'n' undeclared (first use in this function) 11 | while(scanf("%d %d",&n, &s)!=EOF){ | ^ main.c:11:24: note: each undeclared identifier is reported only once for each function it appears in main.c:11:28: error: 's' undeclared (first use in this function) 11 | while(scanf("%d %d",&n, &s)!=EOF){ | ^
s063742155
p00070
C
#include <stdio.h> int search(int, int, int, int*); int main(void) { int i; int count; int isUsed[10]={0,0,0,0,0,0,0,0,0,0}; while(scanf("%d %d",&n, &s)!=EOF){ count=0; for(i=0; i<10; i++){ isUsed[i]=1; count+=search(s, n, i, isUsed); isUsed[i]=0; } printf("%d\n", count); } return 0; } int search(int remain, int n, int k, int* isUsed) { int i; int count; remain-=n*k; if(remain<0) return 0; if(n==1 && remain==0) return 1; for(i=0; i<10; i++){ if(isUsed[i]==1) continue; isUsed[i]=1; count+=search(remain, n-1, i, isUsed); isUsed[i]=0; } return count; }
main.c: In function 'main': main.c:11:24: error: 'n' undeclared (first use in this function) 11 | while(scanf("%d %d",&n, &s)!=EOF){ | ^ main.c:11:24: note: each undeclared identifier is reported only once for each function it appears in main.c:11:28: error: 's' undeclared (first use in this function) 11 | while(scanf("%d %d",&n, &s)!=EOF){ | ^
s942718898
p00070
C
#include <stdio.h> int main(void) { int ball[10]; int N; int B, C, tmp; int i, j; scanf("%d", &N); for(i=0; i<N; i++){ scanf("%d %d %d %d %d %d %d %d %d %d", &ball[0], &ball[1], &ball[2], &ball[3], &ball[4], &ball[5], &ball[6], &ball[7], &ball[8], &ball[9]); B=11; C=11; for(j=9; j>=0; j--){ //B is always smaller. if(B>ball[j]) B=ball[j]; else if(C>ball[j]) C=ball[j]; else break; if(B>C){ tmp=B; B=C; C=tmp;} } if(j==-1) printf("YES\n"); else printf("NO\n"); } return 0; } //0070 Combination of Number Sequences #include <stdio.h> int search(int, int, int, int*); int main(void) { int i; int n, s; int count; int isUsed[10]={0,0,0,0,0,0,0,0,0,0}; while(scanf("%d %d",&n, &s)!=EOF){ count=0; for(i=0; i<10; i++){ isUsed[i]=1; count+=search(s, n, i, isUsed); isUsed[i]=0; } printf("%d\n", count); } return 0; } int search(int remain, int n, int k, int* isUsed) { int i; int count=0; remain-=n*k; if(remain<0) return 0; if(n==1 && remain==0) return 1; for(i=0; i<10; i++){ if(isUsed[i]==1) continue; isUsed[i]=1; count+=search(remain, n-1, i, isUsed); isUsed[i]=0; } return count; }
main.c:36:5: error: redefinition of 'main' 36 | int main(void) | ^~~~ main.c:3:5: note: previous definition of 'main' with type 'int(void)' 3 | int main(void) | ^~~~
s277345792
p00070
C
using System; using System.Collections; //using System.Collections.Generic; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ String s=""; while(true){ if((s=rs())==null)return; var d=s.Split(' '); N=int.Parse(d[0]); S=int.Parse(d[1]); if(S>=400 || N>10){ Console.WriteLine("0"); }else{ Console.WriteLine("{0}",memo[N][S]); } } } void dfs(int[] route_,int sum){ //if(sum>S)return; int[] route=new int[10]; int[] used=new int[10]; for(int i=0;i<10;i++)used[i]=0; int now=-1; for(int i=0;i<10;i++){ route[i]=route_[i]; if(route[i]!=-1){ now=i; used[route[i]]=1; } } sum+=(now+1)*route[now]; memo[now+1][sum]+=1; if(now==10-1){ //if(S==sum)Ans++; return; } for(int i=0;i<=9;i++){ if(used[i]==0){ route[now+1]=i; dfs(route,sum); route[now+1]=-1; } } sum-=(now+1)*route[now]; return; } int[][] memo; int N; int S; public Sol(){ memo=new int[11][]; for(int i=0;i<=10;i++){ memo[i]=new int[400]; for(int j=0;j<400;j++)memo[i][j]=0; } int[] route=new int[10]; for(int i=0;i<10;i++)route[i]=-1; for(int i=0;i<=9;i++){ int sum=0; route[0]=i; dfs(route,sum); route[0]=-1; } } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }
main.c:1:1: error: unknown type name 'using' 1 | using System; | ^~~~~ main.c:2:1: error: unknown type name 'using' 2 | using System.Collections; | ^~~~~ main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | using System.Collections; | ^ main.c:5:1: error: unknown type name 'class' 5 | class TEST{ | ^~~~~ main.c:5:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 5 | class TEST{ | ^ main.c:12:1: error: unknown type name 'class' 12 | class Sol{ | ^~~~~ main.c:12:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 12 | class Sol{ | ^
s361320634
p00070
C++
#include<iostream> using namespace std; int a[10],n,s; int f(int i,int sum) { if(i==n)return sum==s; int ans=0; for(int j=0;j<10;j++) { if(a[j])continue; a[j]=1; ans+=f(i+1,sum+j*(i+1)); a[j]=0; } return ans; } main() { while(cin>>n>>s) { cout<<f()<<endl; } }
a.cc:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 17 | main() | ^~~~ a.cc: In function 'int main()': a.cc:21:16: error: too few arguments to function 'int f(int, int)' 21 | cout<<f()<<endl; | ~^~ a.cc:4:5: note: declared here 4 | int f(int i,int sum) | ^
s286408995
p00070
C++
#include<iostream> using namespace std; int a[10],n,s; int memo[11][330]; void f(int i,int sum) { dp[i][sum]++; if(i==10)return; for(int j=0;j<10;j++) { if(sum+j*(i+1)>s)return ans; if(a[j])continue; a[j]=1; f(i+1,sum+j*(i+1)); a[j]=0; } } main() { f(0,0); while(cin>>n>>s) { cout<<(s>330?0:dp[n][s])<<endl; } }
a.cc: In function 'void f(int, int)': a.cc:7:5: error: 'dp' was not declared in this scope 7 | dp[i][sum]++; | ^~ a.cc:11:33: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | if(sum+j*(i+1)>s)return ans; | ^~~ | abs a.cc: At global scope: a.cc:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 18 | main() | ^~~~ a.cc: In function 'int main()': a.cc:23:24: error: 'dp' was not declared in this scope 23 | cout<<(s>330?0:dp[n][s])<<endl; | ^~
s262866273
p00070
C++
#include<iostream> using namespace std; int a[10],n,s; int dp[11][330]; void f(int i,int sum) { dp[i][sum]++; if(i==10)return; for(int j=0;j<10;j++) { if(sum+j*(i+1)>s)return ans; if(a[j])continue; a[j]=1; f(i+1,sum+j*(i+1)); a[j]=0; } } main() { f(0,0); while(cin>>n>>s) { cout<<(s>330?0:dp[n][s])<<endl; } }
a.cc: In function 'void f(int, int)': a.cc:11:33: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | if(sum+j*(i+1)>s)return ans; | ^~~ | abs a.cc: At global scope: a.cc:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 18 | main() | ^~~~
s233353290
p00070
C++
include <iostream> #include <string.h> #define REP(i,k,n) for(int i=k;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) using namespace std; int flag[10]; int count; void dfs(int i,int max,int a,int sum) { if(a > sum || i > max+1 || sum > 330) { return; } else if(a == sum && i == max+1) { count++; } else { rep(k,10) { if(flag[k] == 0) { flag[k] = 1; int temp = i*k; dfs(i+1,max,a+i*k,sum); flag[k] = 0; } } } } int main() { int n,s; while(cin >> n >> s) { memset(flag,0,sizeof(flag)); count = 0; dfs(1,n,0,s); cout << count << endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:41:15: error: 'cin' was not declared in this scope 41 | while(cin >> n >> s) | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <string.h> +++ |+#include <iostream> 3 | a.cc:43:17: error: 'memset' was not declared in this scope 43 | memset(flag,0,sizeof(flag)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <string.h> +++ |+#include <cstring> 3 | a.cc:46:17: error: 'cout' was not declared in this scope 46 | cout << count << endl; | ^~~~ a.cc:46:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:46:34: error: 'endl' was not declared in this scope 46 | cout << count << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <string.h> +++ |+#include <ostream> 3 |
s514956916
p00070
C++
#include <iostream> #include <vector> #include <algorithm> #include <cstdio> #include <bitset> using namespace std; int n, s; int dp[1 << 10][10000]; int c (int i, int sum, int t) { if (t == 0) return (sum == s ? 1 : 0); if (sum > s) return 0; if (dp[i][s-sum] >= 0) return dp[i][s-sum]; int res = 0; for (int j = 0; j < 10; j++) { if ((i & 1 << j) > 0 && c(i - (1 << j), sum + j * t, t-1)) res++; } return dp[i][s-sum] = res; } int main () { for (int i = 0; i < 1 << 10; i++) for (int j = 0; j < 10000; j++) dp[i][j] = -1; while (cin >> n >> s) { int res = 0; for (int i = 1; i < 1 << 10; i++) { int t = 0; for (int j = 0; j < 10; j++) if ((i & (1 << j)) > 0) t++; if (t == n) { res += c(i,0,t); } } cout << res << endl; } return 0;
a.cc: In function 'int main()': a.cc:41:14: error: expected '}' at end of input 41 | return 0; | ^ a.cc:23:1: note: to match this '{' 23 | { | ^
s234649457
p00070
C++
#include <bits/stdc++.h> #define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) range(i,0,n) using namespace std; int n,s; int rec(int index,int sum,int mask){ if(sum>s) continue; if(index==n){ if(sum==s) return 1; else return 0; } int res=0; rep(i,10){ if(mask&(1<<i)) continue; int nmask=mask|(1<<i); int nsum=sum+(index+1)*i; res+=rec(index+1,nsum,nmask); } return res; } int main(void){ while(cin >> n >> s){ if(cin.eof()) break; cout << rec(0,0,0) << endl; } return 0; }
a.cc: In function 'int rec(int, int, int)': a.cc:9:19: error: continue statement not within a loop 9 | if(sum>s) continue; | ^~~~~~~~
s496298350
p00070
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define loop for(;;) #define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl; #define all(v) begin(v),end(v) #define pb push_back #define inf (1e9) #define eps (1e-9) #typedef long long int Integer; #typedef vector<int> vi; vi lsi(vi xs) { vvi bins; vi bots; for (int x: xs) { auto it = lower_bound(begin(bots), end(bots), x); if (it == end(bots)) { bins.push_back({x}); bots.push_back(x); } else { bins[it - begin(bots)].push_back(x); *it = x; } } int n = bots.size(); vi ret(n); int x = inf; for (--n; n>=0; --n) { reverse(begin(bins[n]), end(bins[n])); x = *(lower_bound(begin(bins[n]), end(bins[n]), x) - 1); ret[n] = x; } return ret; } int solve(int n, Integer s) { vi xs(10); vi ys(n); rep (i, 10) xs[i] = i; set<vi> aa; do { Integer t = 0; rep (i, n) { t += xs[i] * (i+1); ys[i] = xs[i]; } if (t == s) { aa.insert(ys); } } while (next_permutation(all(xs))); return aa.size(); } int main() { cin.tie(0); ios::sync_with_stdio(0); cout.setf(ios::fixed); cout.precision(10); random_device dev; mt19937 rand(dev()); int n; Integer s; while (cin >> n >> s) { cout << solve(n, s) << endl; } return 0; }
a.cc:12:2: error: invalid preprocessing directive #typedef 12 | #typedef long long int Integer; | ^~~~~~~ a.cc:13:2: error: invalid preprocessing directive #typedef 13 | #typedef vector<int> vi; | ^~~~~~~ a.cc:15:1: error: 'vi' does not name a type; did you mean 'void'? 15 | vi lsi(vi xs) { | ^~ | void a.cc:39:18: error: 'Integer' has not been declared 39 | int solve(int n, Integer s) { | ^~~~~~~ a.cc: In function 'int solve(int, int)': a.cc:40:3: error: 'vi' was not declared in this scope 40 | vi xs(10); | ^~ a.cc:41:5: error: expected ';' before 'ys' 41 | vi ys(n); | ^~~ | ; a.cc:42:15: error: 'xs' was not declared in this scope; did you mean 's'? 42 | rep (i, 10) xs[i] = i; | ^~ | s a.cc:43:9: error: template argument 2 is invalid 43 | set<vi> aa; | ^ a.cc:43:9: error: template argument 3 is invalid a.cc:45:5: error: 'Integer' was not declared in this scope 45 | Integer t = 0; | ^~~~~~~ a.cc:47:7: error: 't' was not declared in this scope 47 | t += xs[i] * (i+1); | ^ a.cc:47:12: error: 'xs' was not declared in this scope; did you mean 's'? 47 | t += xs[i] * (i+1); | ^~ | s a.cc:48:7: error: 'ys' was not declared in this scope; did you mean 's'? 48 | ys[i] = xs[i]; | ^~ | s a.cc:50:9: error: 't' was not declared in this scope 50 | if (t == s) { | ^ a.cc:51:10: error: request for member 'insert' in 'aa', which is of non-class type 'int' 51 | aa.insert(ys); | ^~~~~~ a.cc:51:17: error: 'ys' was not declared in this scope; did you mean 's'? 51 | aa.insert(ys); | ^~ | s a.cc:53:33: error: 'xs' was not declared in this scope; did you mean 's'? 53 | } while (next_permutation(all(xs))); | ^~ a.cc:7:22: note: in definition of macro 'all' 7 | #define all(v) begin(v),end(v) | ^ a.cc:54:13: error: request for member 'size' in 'aa', which is of non-class type 'int' 54 | return aa.size(); | ^~~~ a.cc: In function 'int main()': a.cc:65:10: error: 'Integer' was not declared in this scope 65 | int n; Integer s; | ^~~~~~~ a.cc:66:22: error: 's' was not declared in this scope 66 | while (cin >> n >> s) { | ^
s811902919
p00070
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define loop for(;;) #define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl; #define all(v) begin(v),end(v) #define pb push_back #define inf (1e9) #define eps (1e-9) #typedef long long Integer; #typedef vector<int> vi; vi lsi(vi xs) { vvi bins; vi bots; for (int x: xs) { auto it = lower_bound(begin(bots), end(bots), x); if (it == end(bots)) { bins.push_back({x}); bots.push_back(x); } else { bins[it - begin(bots)].push_back(x); *it = x; } } int n = bots.size(); vi ret(n); int x = inf; for (--n; n>=0; --n) { reverse(begin(bins[n]), end(bins[n])); x = *(lower_bound(begin(bins[n]), end(bins[n]), x) - 1); ret[n] = x; } return ret; } int solve(int n, Integer s) { vi xs(10); vi ys(n); rep (i, 10) xs[i] = i; set<vi> aa; do { Integer t = 0; rep (i, n) { t += xs[i] * (i+1); ys[i] = xs[i]; } if (t == s) { aa.insert(ys); } } while (next_permutation(all(xs))); return aa.size(); } int main() { cin.tie(0); ios::sync_with_stdio(0); cout.setf(ios::fixed); cout.precision(10); random_device dev; mt19937 rand(dev()); int n; Integer s; while (cin >> n >> s) { cout << solve(n, s) << endl; } return 0; }
a.cc:11:2: error: invalid preprocessing directive #typedef 11 | #typedef long long Integer; | ^~~~~~~ a.cc:13:2: error: invalid preprocessing directive #typedef 13 | #typedef vector<int> vi; | ^~~~~~~ a.cc:15:1: error: 'vi' does not name a type; did you mean 'void'? 15 | vi lsi(vi xs) { | ^~ | void a.cc:39:18: error: 'Integer' has not been declared 39 | int solve(int n, Integer s) { | ^~~~~~~ a.cc: In function 'int solve(int, int)': a.cc:40:3: error: 'vi' was not declared in this scope 40 | vi xs(10); | ^~ a.cc:41:5: error: expected ';' before 'ys' 41 | vi ys(n); | ^~~ | ; a.cc:42:15: error: 'xs' was not declared in this scope; did you mean 's'? 42 | rep (i, 10) xs[i] = i; | ^~ | s a.cc:43:9: error: template argument 2 is invalid 43 | set<vi> aa; | ^ a.cc:43:9: error: template argument 3 is invalid a.cc:45:5: error: 'Integer' was not declared in this scope 45 | Integer t = 0; | ^~~~~~~ a.cc:47:7: error: 't' was not declared in this scope 47 | t += xs[i] * (i+1); | ^ a.cc:47:12: error: 'xs' was not declared in this scope; did you mean 's'? 47 | t += xs[i] * (i+1); | ^~ | s a.cc:48:7: error: 'ys' was not declared in this scope; did you mean 's'? 48 | ys[i] = xs[i]; | ^~ | s a.cc:50:9: error: 't' was not declared in this scope 50 | if (t == s) { | ^ a.cc:51:10: error: request for member 'insert' in 'aa', which is of non-class type 'int' 51 | aa.insert(ys); | ^~~~~~ a.cc:51:17: error: 'ys' was not declared in this scope; did you mean 's'? 51 | aa.insert(ys); | ^~ | s a.cc:53:33: error: 'xs' was not declared in this scope; did you mean 's'? 53 | } while (next_permutation(all(xs))); | ^~ a.cc:7:22: note: in definition of macro 'all' 7 | #define all(v) begin(v),end(v) | ^ a.cc:54:13: error: request for member 'size' in 'aa', which is of non-class type 'int' 54 | return aa.size(); | ^~~~ a.cc: In function 'int main()': a.cc:65:10: error: 'Integer' was not declared in this scope 65 | int n; Integer s; | ^~~~~~~ a.cc:66:22: error: 's' was not declared in this scope 66 | while (cin >> n >> s) { | ^
s779730741
p00070
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define loop for(;;) #define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl; #define all(v) begin(v),end(v) #define pb push_back #define inf (1e9) #define eps (1e-9) typedef long long Integer; typedef vector<int> vi; vi lsi(vi xs) { vvi bins; vi bots; for (int x: xs) { auto it = lower_bound(begin(bots), end(bots), x); if (it == end(bots)) { bins.push_back({x}); bots.push_back(x); } else { bins[it - begin(bots)].push_back(x); *it = x; } } int n = bots.size(); vi ret(n); int x = inf; for (--n; n>=0; --n) { reverse(begin(bins[n]), end(bins[n])); x = *(lower_bound(begin(bins[n]), end(bins[n]), x) - 1); ret[n] = x; } return ret; } int solve(int n, Integer s) { vi xs(10); vi ys(n); rep (i, 10) xs[i] = i; set<vi> aa; do { Integer t = 0; rep (i, n) { t += xs[i] * (i+1); ys[i] = xs[i]; } if (t == s) { aa.insert(ys); } } while (next_permutation(all(xs))); return aa.size(); } int main() { cin.tie(0); ios::sync_with_stdio(0); cout.setf(ios::fixed); cout.precision(10); random_device dev; mt19937 rand(dev()); int n; Integer s; while (cin >> n >> s) { cout << solve(n, s) << endl; } return 0; }
a.cc: In function 'vi lsi(vi)': a.cc:16:3: error: 'vvi' was not declared in this scope; did you mean 'vi'? 16 | vvi bins; | ^~~ | vi a.cc:21:7: error: 'bins' was not declared in this scope 21 | bins.push_back({x}); | ^~~~ a.cc:24:7: error: 'bins' was not declared in this scope 24 | bins[it - begin(bots)].push_back(x); | ^~~~ a.cc:32:19: error: 'bins' was not declared in this scope 32 | reverse(begin(bins[n]), end(bins[n])); | ^~~~
s356571664
p00070
C++
include<iostream> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) using namespace std; int sum; int n,s; void func(int i,int j,bool check[10]){ if(j<0)return; if(i==n && j==0)sum++; for(int k=0;k<10;k++){ if(check[k]){ check[k]=false; func(i+1,j-k*(i+1),check); check[k]=true; } } } int main(){ while(cin>>n>>s){ bool ch[10]; rep(i,10)ch[i]=true; sum=0; func(0,s,ch); cout<<sum<<endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:22:9: error: 'cin' was not declared in this scope 22 | while(cin>>n>>s){ | ^~~ a.cc:27:5: error: 'cout' was not declared in this scope 27 | cout<<sum<<endl; | ^~~~ a.cc:27:16: error: 'endl' was not declared in this scope 27 | cout<<sum<<endl; | ^~~~
s651493538
p00070
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define repc(i,s,e) for(int i=(s); i<(e); i++) #define pb(n) push_back((n)) #define mp(n,m) make_pair((n),(m)) #define all(r) r.begin(),r.end() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef vector<ll> vl; typedef vector<vl> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 10000000; const int MOD = 1e9 + 7; int main(){ int n, s, ans; while(cin>>n>>s){ if(n == 0 && s == 0) break; vector<int> v(10, 0); rep(i, n) v[i] = i; set<vector<int> > st; ans = 0; do{ vi u(v.begin(), v.begin() + n); if(st.conunt(u)) continue; st.insert(u); int sum = 0; for(int i =0; i < n; i++){ sum += v[i] * (i + 1); } if(sum == s) ans++; }while(next_permutation(all(v)); cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:50:31: error: 'class std::set<std::vector<int> >' has no member named 'conunt'; did you mean 'count'? 50 | if(st.conunt(u)) continue; | ^~~~~~ | count a.cc:57:48: error: expected ')' before ';' token 57 | }while(next_permutation(all(v)); | ~ ^ | )
s542912218
p00070
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define repc(i,s,e) for(int i=(s); i<(e); i++) #define pb(n) push_back((n)) #define mp(n,m) make_pair((n),(m)) #define all(r) r.begin(),r.end() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef vector<ll> vl; typedef vector<vl> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 10000000; const int MOD = 1e9 + 7; int main(){ int n, s, ans; while(cin>>n>>s){ if(n == 0 && s == 0) break; vector<int> v(10, 0); rep(i, n) v[i] = i; set<vector<int> > st; ans = 0; do{ vi u(v.begin(), v.begin() + n); if(st.count(u)) continue; st.insert(u); int sum = 0; for(int i =0; i < n; i++){ sum += v[i] * (i + 1); } if(sum == s) ans++; }while(next_permutation(all(v)); cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:57:48: error: expected ')' before ';' token 57 | }while(next_permutation(all(v)); | ~ ^ | )
s307144525
p00070
C++
#include<iostream> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<vector> #include<cmath> #include<cstring> #include<cstdio> #include<time.h> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define all(in) in.begin(),in.end() const double PI=acos(-1); const double EPS=1e-10; const int inf=1e8; using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; using namespace std; int main(){ int n,s; while(cin>>n>>s){ vi d(10); int co=0; rep(i,10)d[i]=i; do{ do{ int sum=0; rep(i,n)sum+=(i+1)*d[i]; if(sum==s){ co++; } }while(next_permutation(d.begin(),d.begin+n)); }while(next_combination(d.begin(),d.begin()+n,d.end())); cout<<co<<endl; } }
a.cc: In function 'int main()': a.cc:38:66: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+' 38 | }while(next_permutation(d.begin(),d.begin+n)); | ~~~~~~~^~ | | | | | int | <unresolved overloaded function type> a.cc:39:24: error: 'next_combination' was not declared in this scope 39 | }while(next_combination(d.begin(),d.begin()+n,d.end())); | ^~~~~~~~~~~~~~~~
s816350836
p00070
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <algorithm> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <stack> #include <queue> #include <random> #define INF (1<<21) #define swap(a,b) {a=a+b; b=a-b; a=a-b;} #define abs(a) (a > 0 ? a:-a) using namespace std; int rec() { if (choose_size == N) { int sum = 0; for (int i = 0; i < N; i++) { sum += (i + 1) * choose[i]; } return ans == sum; } int cnt = 0; for (int i = 0; i < rest_size; i++) { choose[choose_size++] = rest[i]; for (int j = i; j < rest_size-1; j++) { rest[j] = rest[j + 1]; } rest_size--; cnt += rec(); rest_size++; for (int j = rest_size-1; j > i; j--) { rest[j] = rest[j-1]; } rest[i] = choose[--choose_size]; } return cnt; } void q70() { int n, s; for (; cin >> n >> s;) { N = n; ans = s; choose_size = 0; for (int i = 0; i < MAX_N; i++) { rest[i] = i; } rest_size = 10; cout << rec() << endl;; } } int main() { q70(); return 0; }
a.cc: In function 'int rec()': a.cc:19:13: error: 'choose_size' was not declared in this scope 19 | if (choose_size == N) { | ^~~~~~~~~~~ a.cc:19:28: error: 'N' was not declared in this scope 19 | if (choose_size == N) { | ^ a.cc:22:42: error: 'choose' was not declared in this scope 22 | sum += (i + 1) * choose[i]; | ^~~~~~ a.cc:24:24: error: 'ans' was not declared in this scope; did you mean 'abs'? 24 | return ans == sum; | ^~~ | abs a.cc:28:29: error: 'rest_size' was not declared in this scope 28 | for (int i = 0; i < rest_size; i++) { | ^~~~~~~~~ a.cc:29:17: error: 'choose' was not declared in this scope 29 | choose[choose_size++] = rest[i]; | ^~~~~~ a.cc:29:24: error: 'choose_size' was not declared in this scope 29 | choose[choose_size++] = rest[i]; | ^~~~~~~~~~~ a.cc:29:41: error: 'rest' was not declared in this scope 29 | choose[choose_size++] = rest[i]; | ^~~~ a.cc: In function 'void q70()': a.cc:49:17: error: 'N' was not declared in this scope 49 | N = n; | ^ a.cc:50:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 50 | ans = s; | ^~~ | abs a.cc:51:17: error: 'choose_size' was not declared in this scope 51 | choose_size = 0; | ^~~~~~~~~~~ a.cc:52:37: error: 'MAX_N' was not declared in this scope 52 | for (int i = 0; i < MAX_N; i++) { | ^~~~~ a.cc:53:25: error: 'rest' was not declared in this scope 53 | rest[i] = i; | ^~~~ a.cc:55:17: error: 'rest_size' was not declared in this scope 55 | rest_size = 10; | ^~~~~~~~~
s955369451
p00070
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int rec() { if (choose_size == N) { int sum = 0; for (int i = 0; i < N; i++) { sum += (i + 1) * choose[i]; } return ans == sum; } int cnt = 0; for (int i = 0; i < rest_size; i++) { choose[choose_size++] = rest[i]; for (int j = i; j < rest_size-1; j++) { rest[j] = rest[j + 1]; } rest_size--; cnt += rec(); rest_size++; for (int j = rest_size-1; j > i; j--) { rest[j] = rest[j-1]; } rest[i] = choose[--choose_size]; } return cnt; } void q70() { int n, s; for (; cin >> n >> s;) { N = n; ans = s; choose_size = 0; for (int i = 0; i < MAX_N; i++) { rest[i] = i; } rest_size = 10; cout << rec() << endl;; } } int main() { q70(); return 0; }
a.cc: In function 'int rec()': a.cc:8:13: error: 'choose_size' was not declared in this scope 8 | if (choose_size == N) { | ^~~~~~~~~~~ a.cc:8:28: error: 'N' was not declared in this scope 8 | if (choose_size == N) { | ^ a.cc:11:42: error: 'choose' was not declared in this scope 11 | sum += (i + 1) * choose[i]; | ^~~~~~ a.cc:13:24: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | return ans == sum; | ^~~ | abs a.cc:17:29: error: 'rest_size' was not declared in this scope 17 | for (int i = 0; i < rest_size; i++) { | ^~~~~~~~~ a.cc:18:17: error: 'choose' was not declared in this scope 18 | choose[choose_size++] = rest[i]; | ^~~~~~ a.cc:18:24: error: 'choose_size' was not declared in this scope 18 | choose[choose_size++] = rest[i]; | ^~~~~~~~~~~ a.cc:18:41: error: 'rest' was not declared in this scope 18 | choose[choose_size++] = rest[i]; | ^~~~ a.cc: In function 'void q70()': a.cc:38:17: error: 'N' was not declared in this scope 38 | N = n; | ^ a.cc:39:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 39 | ans = s; | ^~~ | abs a.cc:40:17: error: 'choose_size' was not declared in this scope 40 | choose_size = 0; | ^~~~~~~~~~~ a.cc:41:37: error: 'MAX_N' was not declared in this scope 41 | for (int i = 0; i < MAX_N; i++) { | ^~~~~ a.cc:42:25: error: 'rest' was not declared in this scope 42 | rest[i] = i; | ^~~~ a.cc:44:17: error: 'rest_size' was not declared in this scope 44 | rest_size = 10; | ^~~~~~~~~
s663495708
p00070
C++
#include <iostream> #include<cstdlib> using namespace std; int table[10+1][331]; bool memo[10]; int n; void rec(int depth, int sum) { table[depth][sum]++; for (int i = 0; i <= 9; i++) { if (memo[i]) continue; memo[i] = true; rec(depth + 1, sum + i * (depth+1)); memo[i] = false; } } void q70() { memset(table, 0, sizeof(table)); memset(memo, 0, sizeof(memo)); rec(0, 0); int n, s; for (; cin >> n >> s;) { if (n > 10 || s > 330) { cout << "0" << endl; continue; } cout << table[n][s] << endl; } } int main() { q70(); return 0; }
a.cc: In function 'void q70()': a.cc:19:9: error: 'memset' was not declared in this scope 19 | memset(table, 0, sizeof(table)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<cstdlib> +++ |+#include <cstring> 3 | using namespace std;
s734734154
p00070
C++
#include <iostream> #include <vector> #include <string> using namespace std; int num[10]; long fact[10],dp[10][331];//??????331??\?????????????????¨????????????dp[10][1000]??¨?????§??????????????? int main(){ for(int i = 0; i < 10; i++){ num[i] = i; } do{ int t = 0; for(int i = 0; i < 10; i++){ t += num[i]*(i+1); dp[i][t]++; } }while(next_permutation(num,num+10)); fact[0] = 1; for(int i = 1; i < 10; i++){ fact[i] = fact[i-1]*i; } int n,s; while(cin>>n>>s){ if(n > 10 || s > 330){ cout<<0<<endl; continue; } if(n == 0){ if(s == 0) cout<<1<<endl; else cout<<0<<endl; continue; } cout<<dp[n-1][s]/fact[10-n]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:16: error: 'next_permutation' was not declared in this scope 20 | }while(next_permutation(num,num+10)); | ^~~~~~~~~~~~~~~~
s098439732
p00070
C++
#include <iostream> using namespace std; typedef struct { int val[10]; } numType; int func(int n, int s, numType set) { int sum = 0; int new_n; if (n <= 0) return 0; if (n == 1) { if (s >= 9) return 0; return (set.val[s] != 1) ? 0 : 1; } for (int k = 9; k >= 0; k--) { if (set.val[k] == 0) continue; new_n = s - (n * k); if (new_n < 0) continue; set.val[k] = 0; sum += func(n - 1, new_n, set); set.val[k] = 1; } return sum; } int main(int argc, char* argv[]) { int n, s; numType set; memset(&set, 0, sizeof(set)); while (1) { cin >> n >> s; for (int i = 0; i < 10 ; i++) set.val[i] = 1; cout << func(n, s, set) << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:32:9: error: 'memset' was not declared in this scope 32 | memset(&set, 0, sizeof(set)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 |
s874618401
p00070
C++
#include <memory> #include <iostream> using namespace std; typedef struct { int val[10]; } numType; int func(int n, int s, numType set) { int sum = 0; int new_n; if (n <= 0) return 0; if (n == 1) { if (s >= 9) return 0; return (set.val[s] != 1) ? 0 : 1; } for (int k = 9; k >= 0; k--) { if (set.val[k] == 0) continue; new_n = s - (n * k); if (new_n < 0) continue; set.val[k] = 0; sum += func(n - 1, new_n, set); set.val[k] = 1; } return sum; } int main(int argc, char* argv[]) { int n, s; numType set; memset(&set, 0, sizeof(set)); while (1) { cin >> n >> s; for (int i = 0; i < 10 ; i++) set.val[i] = 1; cout << func(n, s, set) << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:32:9: error: 'memset' was not declared in this scope 32 | memset(&set, 0, sizeof(set)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 |
s995028682
p00070
C++
class Memo { int flag; Memo(int n) :flag{ n } {} public: Memo() :flag{ 0 } {} class Iterator { const int flag; int n; public: Iterator(int aflag, int an) :flag{ aflag }, n{ an } {} int operator*() const { return n; } Iterator operator++() { while (((1 << ++n) | flag) == flag && n < 10); return *this; } bool operator!=(const Iterator other) const { return n != other.n; } }; Memo use(int u) { return Memo(flag | (1 << u)); } Iterator begin() const { return ++Iterator(flag, -1); } Iterator end() const { return Iterator(flag, 10); } }; int f(int n, int s, Memo memo = Memo()) { if (n == 0 && s == 0) return 1; if (s <= 0) return 0; if (n == 0) return 0; int sum = 0; for (const auto &unuse : memo) { sum += f(n - 1, s - unuse * n, memo.use(unuse)); } return sum; } int main() { int n, s; while (std::cin >> n >> s) { std::cout << f(n, s) << std::endl; } }
a.cc: In function 'int main()': a.cc:45:21: error: 'cin' is not a member of 'std' 45 | while (std::cin >> n >> s) { | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | a.cc:46:22: error: 'cout' is not a member of 'std' 46 | std::cout << f(n, s) << std::endl; | ^~~~ a.cc:46:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:46:46: error: 'endl' is not a member of 'std' 46 | std::cout << f(n, s) << std::endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 |
s492553930
p00070
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int N, S; while(cin >> N >> S) { int pats[10]; for(int i = 0; i < 10; ++i) pats[i] = i<N ? 1 : 0; reverse(pats, pats+10); int ans = 0; do { int list[N], *pt = list; for(int i = 0; i < 10; ++i) if(pats[i]) *pt++ = i; do { int sum = 0; for(int i = 0; i < N; ++i) sum += list[i]*(i+1); if(sum == S) ++ans; } while(next_permutation(list, list+N)); } while(next_permutation(pats, pats+10)); cout << ans << endl; } return 0; } #include <iostream> #include <algorithm> using namespace std; int main() { int N, S; while(cin >> N >> S) { int pats[10]; for(int i = 0; i < 10; ++i) pats[i] = i<N ? 1 : 0; reverse(pats, pats+10); int ans = 0; do { int list[N], *pt = list; for(int i = 0; i < 10; ++i) if(pats[i]) *pt++ = i; do { int sum = 0; for(int i = 0; i < N; ++i) sum += list[i]*(i+1); if(sum == S) ++ans; } while(next_permutation(list, list+N)); } while(next_permutation(pats, pats+10)); cout << ans << endl; } return 0; }
a.cc:35:5: error: redefinition of 'int main()' 35 | int main() { | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main() { | ^~~~
s002505196
p00070
C++
#include <iostream> #include <sstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <climits> #include <cfloat> using namespace std; int main() { for(;;){ int n, s; if(!(cin >> n >> s)) return 0; vector<int> num(10); for(int i=0; i<10; ++i) num[i] = i; int ret = 0; do{ int a = 0; for(int i=0; i<n; ++i) a += num[i] * (i+1); if(a == s) ++ ret; }while(next_permutation(num.begin(), num.end())); for(int i=0; i<10-n; ++i) ret /= (i+1); cout << ret << endl; } }#include <iostream> #include <sstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <climits> #include <cfloat> using namespace std; int solve(int x, int n, int s, bitset<10>& check){ if(x == n){ if(s == 0) return 1; else return 0; } int ret = 0; for(int i=0; i<10; ++i){ if(check[i]) continue; check[i] = true; ret += solve(x+1, n, s-i*(x+1), check); check[i] = false; } return ret; } int main() { for(;;){ int n, s; if(!(cin >> n >> s)) return 0; bitset<10> check; cout << solve(0, n, s, check) << endl; } }
a.cc:43:2: error: stray '#' in program 43 | }#include <iostream> | ^ a.cc:43:3: error: 'include' does not name a type 43 | }#include <iostream> | ^~~~~~~ a.cc:80:5: error: redefinition of 'int main()' 80 | int main() | ^~~~ a.cc:19:5: note: 'int main()' previously defined here 19 | int main() | ^~~~
s109657369
p00070
C++
#include <iostream> #include <vector> #include <algorithm> #include <map> using namespace std; int n,s; int cnt=0; int vvv[10]; int size; map<int,int> dp[11][1<<10]; map<int,int> dfs(int d,int si){ if(dp[d][si].size()!=0){ return dp[d][si]; } map<int,int> ret; if(d==n) return ret; for(int i = 0; i < 10; i++){ if((si>>i)&1==1){ map<int,int> &ss = dfs(d+1,(si&~(1<<i))); if(ss.size()==0){ ret[((d+1)*i)]++; } else{ for(map<int,int>::iterator it = ss.begin(); it!=ss.end(); it++){ ret[(it->first)+(d+1)*i]+=it->second; } } } } dp[d][si]=ret; return dp[d][si]; } bool used[10]; void dfs2(int d,int sum){ if(d==n){ if(sum==s) cnt++; return; } for(int i = 0; i < 10; i++){ if(!used[i]){ used[i]=true; dfs2(d+1,sum+(d+1)*i); used[i]=false; } } } int main(){ while(cin>>n>>s){ fill(used,used+10,false); size=0; cnt=0; //dfs2(0,0); //cout<<cnt<<endl; map<int,int> &m = dfs(0,(1<<10)-1); cout<<m[s]<<endl; for(int i = 0; i < 11; i++){ for(int j = 0; j < (1<<10); j++){ dp[i][j].clear(); } } } return 0; }
a.cc: In function 'std::map<int, int> dfs(int, int)': a.cc:26:47: error: cannot bind non-const lvalue reference of type 'std::map<int, int>&' to an rvalue of type 'std::map<int, int>' 26 | map<int,int> &ss = dfs(d+1,(si&~(1<<i))); | ~~~^~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:62:17: error: reference to 'size' is ambiguous 62 | size=0; | ^~~~ In file included from /usr/include/c++/14/string:53, 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/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:12:5: note: 'int size' 12 | int size; | ^~~~ a.cc:66:38: error: cannot bind non-const lvalue reference of type 'std::map<int, int>&' to an rvalue of type 'std::map<int, int>' 66 | map<int,int> &m = dfs(0,(1<<10)-1); | ~~~^~~~~~~~~~~~~
s836622218
p00070
C++
#include<iostream> #include<string> using namespace std; int main(){ int n,s; int a[10],ans; while(cin >> n >> s){ ans = 0; int comb = (1 << n) - 1; while(comb < (1<<10)){ int cnt = 0; for(int i=0;i<10;i++){ if(comb >> i & 1){ a[cnt++] = i; } } do{ int sum = 0; for(int i=0;i<n;i++){ sum += a[i] * (i+1); } if(sum == s)ans++; }while(next_permutation(a,a+n)); int x = comb & -comb, y = comb + x; comb = ( (comb & ~y) / x >> 1 | y); } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:25:14: error: 'next_permutation' was not declared in this scope 25 | }while(next_permutation(a,a+n)); | ^~~~~~~~~~~~~~~~
s385955777
p00070
C++
include <cstdio> include <cmath> int DP[12][1030][331]; int slove(int k,int u,int s){ if(n>=11) return 0; if(s>=331) return 0; int res=0; if(s<0)return 0; if(DP[k][u][s]>=0) return DP[k][u][s]; if(k==n) { if((s%k)==0&&((int)pow(2,(s/k))&u)==0&&s/k<10){ res=1; //printf("%d %d %d hit\n",k,u,s); } } else { for(int i=0;i<10;i++){ if(((int)pow(2,i)&u)==0){ res+=slove(k+1,u+pow(2,i),s-i*k); } } } DP[k][u][s]=res; return res; } int main() { int m; int bn=-1; while(scanf("%d %d",&n,&m)!=EOF){ if(bn!=n){ for(int x=0;x<12;x++){ for(int y=0;y<1030;y++) for(int z=0;z<331;z++){ DP[x][y][z]=-1; } } } printf("%d\n",slove(1,0,m)); fflush(stdout); bn=n; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <cstdio> | ^~~~~~~ a.cc: In function 'int slove(int, int, int)': a.cc:6:12: error: 'n' was not declared in this scope 6 | if(n>=11) return 0; | ^ a.cc:10:12: error: 'DP' was not declared in this scope 10 | if(DP[k][u][s]>=0) return DP[k][u][s]; | ^~ a.cc:11:15: error: 'n' was not declared in this scope 11 | if(k==n) { | ^ a.cc:12:36: error: 'pow' was not declared in this scope 12 | if((s%k)==0&&((int)pow(2,(s/k))&u)==0&&s/k<10){ | ^~~ a.cc:18:34: error: 'pow' was not declared in this scope 18 | if(((int)pow(2,i)&u)==0){ | ^~~ a.cc:23:9: error: 'DP' was not declared in this scope 23 | DP[k][u][s]=res; | ^~ a.cc: In function 'int main()': a.cc:29:30: error: 'n' was not declared in this scope; did you mean 'bn'? 29 | while(scanf("%d %d",&n,&m)!=EOF){ | ^ | bn a.cc:29:15: error: 'scanf' was not declared in this scope 29 | while(scanf("%d %d",&n,&m)!=EOF){ | ^~~~~ a.cc:29:37: error: 'EOF' was not declared in this scope 29 | while(scanf("%d %d",&n,&m)!=EOF){ | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | include <cstdio> a.cc:34:49: error: 'DP' was not declared in this scope 34 | DP[x][y][z]=-1; | ^~ a.cc:38:17: error: 'printf' was not declared in this scope 38 | printf("%d\n",slove(1,0,m)); | ^~~~~~ a.cc:38:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' a.cc:39:24: error: 'stdout' was not declared in this scope 39 | fflush(stdout); | ^~~~~~ a.cc:39:24: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' a.cc:39:17: error: 'fflush' was not declared in this scope 39 | fflush(stdout); | ^~~~~~
s925001895
p00070
C++
#include <stdio.h> #include <string.h> #define SIZE (500); int dp[11][1 << 10][SIZE]; int main(void) { int n; int s; memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (int i = 0; i < 10; i++){ for (int j = 0; j < (1 << 10); j++){ for (int k = 0; k < SIZE; k++){ for (int l = 0; l < 10; l++){ if (((j >> l) & 1) == 0){ dp[i + 1][j | (1 << l)][k + ((i + 1) * l)] += dp[i][j][k]; } } } } } while (1){ scanf("%d%d", &n, &s); int ans = 0; for (int i = 0; i < (1 << 10); i++){ ans += dp[n][i][s]; } printf("%d\n", ans); } return (0); }
a.cc:4:19: error: expected ']' before ';' token 4 | #define SIZE (500); | ^ a.cc:6:21: note: in expansion of macro 'SIZE' 6 | int dp[11][1 << 10][SIZE]; | ^~~~ a.cc:6:25: error: expected unqualified-id before ']' token 6 | int dp[11][1 << 10][SIZE]; | ^ a.cc: In function 'int main()': a.cc:13:24: error: 'dp' was not declared in this scope 13 | memset(dp, 0, sizeof(dp)); | ^~ a.cc:17:57: error: expected primary-expression before ';' token 17 | for (int k = 0; k < SIZE; k++){ | ^ a.cc:17:57: error: expected ')' before ';' token 17 | for (int k = 0; k < SIZE; k++){ | ~ ^ a.cc:17:59: error: 'k' was not declared in this scope 17 | for (int k = 0; k < SIZE; k++){ | ^
s374025334
p00070
C++
#include<iostream> int a[11][999]; void r(int n,int u,int s,int d){ a[n][s]++; for(int i=10;i-->0;) if(!(u>>i&1))r(n+1,u^1<<i,s+d*i,d+1); } main(){ r(0,0,0,1); for(int n,s;cin>>n>>s;)cout<<a[n][s]<<endl; }
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:10:13: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 10 | for(int n,s;cin>>n>>s;)cout<<a[n][s]<<endl; | ^~~ | 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 | ^~~ a.cc:10:24: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 10 | for(int n,s;cin>>n>>s;)cout<<a[n][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:10:39: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 10 | for(int n,s;cin>>n>>s;)cout<<a[n][s]<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s993012933
p00070
C++
#include <iostream> #include <cstring> #include <algorithm> using namespace std; int m[10][1024][350]; int search(int n, int s, int p){ if(n == 1){ if(s > 9) return 0; if((p & (1 << s)) == 0) return 1; else return 0; } // if(m[n-1][p][s] != -1) return m[n-1][p][s]; int r = 0; for(int j = min(s/n,9); j >= 0; j--){ if((p & (1 << j)) == 0) { r += search(n-1, s - n * j, (p | i << j)); } } // m[n-1][p][s] = r; return r; } int main() { int n,s; memset(m,-1,sizeof(m)); while(cin >> n >> s){ cout << search(n,s,0) << endl; } return 0; }
a.cc: In function 'int search(int, int, int)': a.cc:16:40: error: 'i' was not declared in this scope 16 | r += search(n-1, s - n * j, (p | i << j)); | ^
s548048658
p00070
C++
#include <iostream> #define MAX_N 10 #define MAX_S 1000 using namespace std; int ans[MAX_N+1][MAX_S]; int used[10]; void calc(int n, int depth, int sum){ if (n+1 == depth) { ans[n][sum]++; return; } for (int i = 0; i < 10; i++) { if (used[i] == 0) { used[i] = 1; calc(n,depth+1,i*depth+sum); used[i] = 0; } } } int main(){ int n, s; memset(ans, 0, sizeof(ans)); // calc any answers for n, s in advance. for (int i = 0; i < 10; i++) { memset(used, 0, sizeof(used)); calc(i+1, 1, 0); } while (cin >> n >> s) { cout << ans[n][s] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:9: error: 'memset' was not declared in this scope 26 | memset(ans, 0, sizeof(ans)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #define MAX_N 10
s996915458
p00070
C++
#include<iostream> #include<cstdlib> using namespace std; int dp[11][1<<10][331]; int dpset(int n, int data, int sum); int main(){ int n,m; memset(dp,-1,sizeof(dp)); while(cin>>n>>m){ if(m>330){cout<<"0"<<endl;} else{cout<<dpset(n,0,m)<<endl;} } return 0; } int dpset(int n, int data, int sum){ int ans = 0; if(dp[n][data][sum]>=0){return dp[n][data][sum];} if(sum<0){return 0;} if(n == 1){ if(!(data&(1<<sum))){ans = 1;} } else{ for(int i=0; i<10; i++){ if(!(data&(1<<i))){ ans+=dpset(n-1,data|(1<<i),sum-i*n); } } } dp[n][data][sum] = ans; return ans; }
a.cc: In function 'int main()': a.cc:8:9: error: 'memset' was not declared in this scope 8 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<cstdlib> +++ |+#include <cstring> 3 | using namespace std;
s072316882
p00070
C++
#include<iostream> #include<algorithm> using namespace std; int dp[20][1000]; void Init(){ //int maxx=0; for(int i=0;i<=10;i++)for(int j=0;j<1000;j++)dp[i][j]=0; for(int i=0;i<=9;i++){ dp[0][i]++; for(int j=0;j<=9;j++){ if(i == j)continue; dp[1][i+j*2]++; for(int k=0;k<=9;k++){ if(k==i||k==j)continue; dp[2][i+j*2+k*3]++; for(int l=0;l<=9;l++){ if(l==i||l==j||l==k)continue; dp[3][i+j*2+k*3+l*4]++; for(int m=0;m<=9;m++){ if(m==i||m==j||m==k||m==l)continue; dp[4][i+j*2+k*3+l*4+m*5]++; for(int n=0;n<=9;n++){ if(n==i||n==j||n==k||n==l||n==m)continue; dp[5][i+j*2+k*3+l*4+m*5+n*6]++; for(int o=0;o<=9;o++){ if(o==i||o==j||o==k||o==l||o==m||o==n)continue; dp[6][i+j*2+k*3+l*4+m*5+n*6+o*7]++; for(int p=0;p<=9;p++){ if(p==i||p==j||p==k||p==l||p==m||p==n||p==o)continue; dp[7][i+j*2+k*3+l*4+m*5+n*6+o*7+p*8]++; for(int q=0;q<=9;q++){ if(q==i||q==j||q==k||q==l||q==m||q==n||q==o||q==p)continue; dp[8][i+j*2+k*3+l*4+m*5+n*6+o*7+p*8+q*9]++; maxx = max(maxx,i+j*2+k*3+l*4+m*5+n*6+o*7+p*8+q*9); } } } } } } } } } // cout << maxx << endl; } int main(){ int n,s; Init(); while(cin >> n >> s){ cout << dp[n-1][s] << endl; } return 0; }
a.cc: In function 'void Init()': a.cc:36:21: error: 'maxx' was not declared in this scope 36 | maxx = max(maxx,i+j*2+k*3+l*4+m*5+n*6+o*7+p*8+q*9); | ^~~~
s573331988
p00070
C++
#include <iostream> #include <bitset> int main() { const int N = 10; const int B = 1 << N; const int SMAX = 330; // 10*9 + 9*8 + ... + 2*1 + 1*0 = 90+72+56+42+30+20+12+6+2+0 = 330 int table[N + 1][SMAX + 1] = {0}; int (*bitTable)[SMAX + 1] = new int[B][SMAX + 1]; int emax[N + 1] = {0}; for (int i = 1; i <= N; ++i) { emax[i] = emax[i - 1] + 9 * i - i * (i - 1) / 2; } bitTable[0][0] = 1; for (int i = 0; i < B; ++i) { std::bitset<N> bs(i); int nbc = bs.count() + 1; for (int j = 0; j < N; ++j) { if (bs.test(j) == false) { std::bitset<N> nextBit = bs; nextBit.set(j); int d = j * nbc; for (int k = 0; k <= emax[nbc]; ++k) { bitTable[nextBit.to_ulong()][k + d] += bitTable[i][k]; } } } } for (int i = 0; i < B; ++i) { std::bitset<N> bs(i); int n = bs.count(); for (int s = 0; s <= emax[n]; ++s) { table[n][s] += bitTable[bs.to_ulong()][s]; } } delete [] bitTable; int n, s; while (std::cin >> n >> s) { if (n <= 0 || n > N || s > SMAX || s < 0) { std::cout << 0 << std::endl;ac continue; } std::cout << table[n][s] << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:52:53: error: 'ac' was not declared in this scope 52 | std::cout << 0 << std::endl;ac | ^~
s450851922
p00070
C++
#include <stdio.h> #include <math.h> int a[10],i,n,s; int summing(int n,int s){ int ans=0,i,max=0,min=0,m; if(n==1){if(s<10 && a[s]==1)return 1; else return 0;} else{ for(i=0,m=n;m>0 && i<10;i++){if(a[i]==1){min+=m*i;m--;}} for(i=9,m=n;m>0 && i>=0;i--){if(a[i]==1){max+=m*i;m--;}} if(s<min || max<s)return 0; //for(i=0;i<10;i++){printf("%d",a[i]);} for(i=0;i<10;i++){ if(a[i]==1 && n*i<=s){ /*if(n==2){ m=s-i*2; if(m>=0 && m<10 && i!=m && a[m]==1)ans++; }*/ else{ a[i]=0; ans+=summing(n-1,s-n*i); a[i]=1; } } } //printf("%d,%d\n",n,ans); return ans; } } int main(void){ for(i=0;i<10;i++)a[i]=1; while(scanf("%d %d",&n,&s)!=EOF){printf("%d\n",summing(n,s));} return 0; }
a.cc: In function 'int summing(int, int)': a.cc:18:17: error: expected '}' before 'else' 18 | else{ | ^~~~ a.cc:13:34: note: to match this '{' 13 | if(a[i]==1 && n*i<=s){ | ^ a.cc: At global scope: a.cc:28:1: error: expected declaration before '}' token 28 | } | ^
s114557351
p00070
C++
import sys d0=[0]*1024 d1=[[0 for i in range(286)]for j in range(1024)] B=[1,2,4,8,16,32,64,128,256,512] def init(): global d for i in range(1024): binary=format(i,'b') n0=binary.count('1') d0[i]=n0 if n0==1: d1[i][B.index(i)]=1 else: for j in range(len(binary)): dp=n0*j if binary[-j-1]=='1': i2=i-B[j] for k in range(286-dp): d1[i][k+dp]+=d1[i2][k] return def f0070(n,s): x=sum([d1[i][s] for i in range(1024) if d0[i]==n]) return x init() for a in sys.stdin: n,s=map(int,a.split()) print f0070(n,s)
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s146889273
p00070
C++
#include <iostream> #include <vector> using namespace std; typedef vector <int> vi; typedef vector <vi> vvi; #define REP(i,n) for(i=0;i<n;i++) int K=1024,N=331,B[]={1,2,4,8,16,32,64,128,256,512},C[1024]={0}; vvi D(K,vi(N)); int init(){ int i,tmp,tmp2,n,dp,i2,j,k; REP(i,K){ REP(j,N)D[i][j]=0; tmp=i,tmp2=0,n=0; while(tmp){ n+=tmp&1; tmp2++; tmp/=2; } C[i]=n; if(n==1)D[i][find(B,B+10,i)-B]=1; else{ tmp=i; REP(j,tmp2){ if(tmp&1){ dp=n*j,i2=i-B[j]; REP(k,N-dp)D[i][k+dp]+=D[i2][k]; } tmp/=2; } } } return 0; } int main(){ init(); int n,s,i,x; while(1){ cin>>n>>s; if(cin.eof())break; x=0; if(s<N) REP(i,K)if(C[i]==n)x+=D[i][s]; cout<<x<<endl; } }
a.cc: In function 'int init()': a.cc:20:34: error: no matching function for call to 'find(int [10], int*, int&)' 20 | if(n==1)D[i][find(B,B+10,i)-B]=1; | ~~~~^~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:20:34: note: mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*' 20 | if(n==1)D[i][find(B,B+10,i)-B]=1; | ~~~~^~~~~~~~~~
s354085910
p00070
C++
#include <iostream> #define REP(i,n) for(i=0;i<n;i++) const int K=1024,N=331; int B[]={1,2,4,8,16,32,64,128,256,512},C[K]={0},D[K][N]={0}; int init(){ int i,tmp,tmp2,n,dp,i2,j,k; REP(i,K){ REP(j,N)D[i][j]=0; tmp=i,tmp2=0,n=0; while(tmp){ n+=tmp&1; tmp2++; tmp/=2; } C[i]=n; if(n==1)D[i][std::find(B,B+10,i)-B]=1; else{ tmp=i; REP(j,tmp2){ if(tmp&1){ dp=n*j,i2=i-B[j]; REP(k,N-dp)D[i][k+dp]+=D[i2][k]; } tmp/=2; } } } return 0; } int main(){ init(); int n,s,i,x; while(1){ std::cin>>n>>s; if(std::cin.eof())break; x=0; if(s<N) REP(i,K)if(C[i]==n)x+=D[i][s]; std::cout<<x<<'\n'; } }
a.cc: In function 'int init()': a.cc:16:39: error: no matching function for call to 'find(int [10], int*, int&)' 16 | if(n==1)D[i][std::find(B,B+10,i)-B]=1; | ~~~~~~~~~^~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:16:39: note: mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*' 16 | if(n==1)D[i][std::find(B,B+10,i)-B]=1; | ~~~~~~~~~^~~~~~~~~~
s778680945
p00070
C++
#include <iostream> #include <string> #include <map> #include <set> #include <cstring> #include <vector> #include <algorithm> using namespace std; int memo[10][10]; int N, S; int dfs(int cnt, int sum) { int ret = 0; if(sum > S) return 0; if(cnt == N+1) { return sum == S; } for(int i=0; i<10; i++) { if(used[i]) continue; used[i] = 1; ret += dfs(cnt + 1, sum + i*cnt); used[i] = 0; } return ret; } int main() { while(cin >> N >> S) { fill(used, used+10, 0); cout << dfs(1, 0) << endl; } return 0; }
a.cc: In function 'int dfs(int, int)': a.cc:23:8: error: 'used' was not declared in this scope 23 | if(used[i]) continue; | ^~~~ a.cc:24:5: error: 'used' was not declared in this scope 24 | used[i] = 1; | ^~~~ a.cc: In function 'int main()': a.cc:35:10: error: 'used' was not declared in this scope 35 | fill(used, used+10, 0); | ^~~~
s848971028
p00071
Java
s=gets.to_i for i in 1..s gets.chomp num=[] 8.times do num<<gets.chomp.split(//).map(&:to_i) end x=gets.to_i-1 y=gets.to_i-1 check=[x,y] until check.empty? y=check.pop x=check.pop (-3).upto(3) do |t| if (x+t)<8 && 0<=(x+t) && num[y][x+t]==1 check<<(x+t).to_i check<<y.to_i num[y][x+t]=0 end if (y+t)<8 && 0<=(y+t) && num[y+t][x]==1 check<<x.to_i check<<(y+t).to_i num[y+t][x]=0 end end end puts "Data #{i}:" 8.times{ |t| puts num[t].join} end
Main.java:1: error: class, interface, enum, or record expected s=gets.to_i ^ 1 error
s998096065
p00071
Java
import java.util.*; public class AOJ0071 { public static char[][] map = new char[8][8]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int max_roop = sc.nextInt(); int playcount =1; while(max_roop>=playcount){ for(int i = 0;i < 8;i++){ String tmp = sc.next(); for(int j = 0;j < 8;j++){ map[i][j] = tmp.charAt(j); } } int m = sc.nextInt(); m--; int n = sc.nextInt(); n--; dfs(n,m); System.out.println("Data "+playcount+":"); for(int i = 0; i <8;i++){ for(int j= 0;j < 8;j++){ System.out.print(map[i][j]); } System.out.println(); } playcount++; } } public static void dfs(int x,int y){ map[x][y]='0'; for(int dx = -3;dx <=3;dx++){ for(int dy = -3; dy <= 3 ; dy++){ if(dx == 0 || dy ==0){ int nx = x + dx; int ny = y + dy; if(0<=nx&&nx<8&&0<=ny&&ny<8&&map[nx][ny]=='1')dfs(nx,ny); } } } return; } }
Main.java:2: error: class AOJ0071 is public, should be declared in a file named AOJ0071.java public class AOJ0071 { ^ 1 error
s604197455
p00071
C
#include <stdio.h> #include <stdlib.h> void Input(BOMB *); void Output(BOMB *); void explode(BOMB *); typedef struct Bomb{ int map[8][8]; } BOMB; int main() { int input_times, input_cnt; BOMB bomb[50]; int x, y; /*Read input and process*/ scanf("%d", &input_times); for(input_cnt = 0; input_cnt < input_times; input_cnt++){ Input(bomb[input_cnt]); scanf("%d", x); scanf("%d", y); bomb[input_cnt].map[x - 1][y - 1] = 2; explode(&bomb[input_cnt]); } /*Output*/ for(input_cnt = 0; input_cnt < input_times; input_cnt++){ printf("Data %d:\n", input_cnt + 1); Output(&bomb[input_cnt]); } return 0; } Input(BOMB *bomb_ptr) { char dump; int x_cnt, y_cnt; dump = getchar(); for(y_cnt = 0; y_cnt < 8; y_cnt++){ dump = getchar(); for(x_cnt = 0; x_cnt < 8; x_cnt++) bomb_ptr->map[x_cnt][x_cnt] = getchar() - 48; /*ASCII table*/ } } Output(BOMB *bomb_ptr) { int x_cnt, y_cnt; for(y_cnt = 0; y_cnt < 8; y_cnt++) { for(x_cnt = 0; x_cnt < 8; x_cnt++) printf("%d", bomb_ptr->map[x_cnt][y_cnt]); printf("\n"); } } void explode(BOMB *bomb_ptr) { int x_cnt, y_cnt; int explode_cnt; for(y_cnt = 0; y_cnt < 8; y_cnt++) for(x_cnt = 0; x_cnt < 8; x_cnt++) /*Find exploded bomb and process*/ if(bomb_ptr->map[x_cnt][y_cnt] == 2) { bomb_ptr->map[x_cnt][y_cnt] = 0; /*Left*/ explode_cnt = 1; while((x_cnt - explode_cnt) >= 0 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt - explode_cnt][y_cnt]) == 1) (bomb_ptr->map[x_cnt - explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Right*/ explode_cnt = 1; while((x_cnt + explode_cnt) <= 7 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt + explode_cnt][y_cnt]) == 1) (bomb_ptr->map[x_cnt + explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Down*/ explode_cnt = 1; while((y_cnt - explode_cnt) >= 0 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt][y_cnt - explode_cnt]) == 1) (bomb_ptr->map[x_cnt][y_cnt - explode_cnt]) = 2; explode_cnt++; } /*Up*/ explode_cnt = 1; while((y_cnt + explode_cnt) <= 7 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt][y_cnt + explode_cnt]) == 1) (bomb_ptr->map[x_cnt][y_cnt + explode_cnt]) = 2; explode_cnt++; } explode(bomb_ptr); } }
main.c:4:12: error: unknown type name 'BOMB' 4 | void Input(BOMB *); | ^~~~ main.c:5:13: error: unknown type name 'BOMB' 5 | void Output(BOMB *); | ^~~~ main.c:6:14: error: unknown type name 'BOMB' 6 | void explode(BOMB *); | ^~~~ main.c: In function 'main': main.c:21:17: error: implicit declaration of function 'Input' [-Wimplicit-function-declaration] 21 | Input(bomb[input_cnt]); | ^~~~~ main.c:25:17: error: implicit declaration of function 'explode' [-Wimplicit-function-declaration] 25 | explode(&bomb[input_cnt]); | ^~~~~~~ main.c:30:17: error: implicit declaration of function 'Output' [-Wimplicit-function-declaration] 30 | Output(&bomb[input_cnt]); | ^~~~~~ main.c: At top level: main.c:36:1: error: return type defaults to 'int' [-Wimplicit-int] 36 | Input(BOMB *bomb_ptr) | ^~~~~ main.c:48:1: error: return type defaults to 'int' [-Wimplicit-int] 48 | Output(BOMB *bomb_ptr) | ^~~~~~ main.c:59:6: warning: conflicting types for 'explode'; have 'void(BOMB *)' {aka 'void(struct Bomb *)'} 59 | void explode(BOMB *bomb_ptr) | ^~~~~~~ main.c:25:17: note: previous implicit declaration of 'explode' with type 'void(BOMB *)' {aka 'void(struct Bomb *)'} 25 | explode(&bomb[input_cnt]); | ^~~~~~~
s961970475
p00071
C
#include <stdio.h> #include <stdlib.h> typedef struct Bomb { int map[8][8]; } BOMB; void Input(BOMB *); void Output(BOMB *); void explode(BOMB); int main() { int input_times, input_cnt; BOMB bomb[50]; int x, y; /*Read input and process*/ scanf("%d", &input_times); for(input_cnt = 0; input_cnt < input_times; input_cnt++){ Input(&bomb[input_cnt]); scanf("%d", x); scanf("%d", y); bomb[input_cnt].map[x - 1][y - 1] = 2; explode(&bomb[input_cnt]); } /*Output*/ for(input_cnt = 0; input_cnt < input_times; input_cnt++){ printf("Data %d:\n", input_cnt + 1); Output(bomb[input_cnt]); } return 0; } Input(BOMB *bomb_ptr) { char dump; int x_cnt, y_cnt; dump = getchar(); for(y_cnt = 0; y_cnt < 8; y_cnt++){ dump = getchar(); for(x_cnt = 0; x_cnt < 8; x_cnt++) bomb_ptr->map[x_cnt][x_cnt] = getchar() - 48; /*ASCII table*/ } } Output(BOMB *bomb_ptr) { int x_cnt, y_cnt; for(y_cnt = 0; y_cnt < 8; y_cnt++) { for(x_cnt = 0; x_cnt < 8; x_cnt++) printf("%d", bomb_ptr->map[x_cnt][y_cnt]); printf("\n"); } } void explode(BOMB *bomb_ptr) { int x_cnt, y_cnt; int explode_cnt; for(y_cnt = 0; y_cnt < 8; y_cnt++) for(x_cnt = 0; x_cnt < 8; x_cnt++) /*Find exploded bomb and process*/ if(bomb_ptr->map[x_cnt][y_cnt] == 2) { bomb_ptr->map[x_cnt][y_cnt] = 0; /*Left*/ explode_cnt = 1; while((x_cnt - explode_cnt) >= 0 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt - explode_cnt][y_cnt]) == 1) (bomb_ptr->map[x_cnt - explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Right*/ explode_cnt = 1; while((x_cnt + explode_cnt) <= 7 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt + explode_cnt][y_cnt]) == 1) (bomb_ptr->map[x_cnt + explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Down*/ explode_cnt = 1; while((y_cnt - explode_cnt) >= 0 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt][y_cnt - explode_cnt]) == 1) (bomb_ptr->map[x_cnt][y_cnt - explode_cnt]) = 2; explode_cnt++; } /*Up*/ explode_cnt = 1; while((y_cnt + explode_cnt) <= 7 && explode_cnt <= 3) { if((bomb_ptr->map[x_cnt][y_cnt + explode_cnt]) == 1) (bomb_ptr->map[x_cnt][y_cnt + explode_cnt]) = 2; explode_cnt++; } explode(bomb_ptr); } }
main.c: In function 'main': main.c:26:25: error: incompatible type for argument 1 of 'explode' 26 | explode(&bomb[input_cnt]); | ^~~~~~~~~~~~~~~~ | | | BOMB * {aka struct Bomb *} main.c:11:14: note: expected 'BOMB' {aka 'struct Bomb'} but argument is of type 'BOMB *' {aka 'struct Bomb *'} 11 | void explode(BOMB); | ^~~~ main.c:31:28: error: incompatible type for argument 1 of 'Output' 31 | Output(bomb[input_cnt]); | ~~~~^~~~~~~~~~~ | | | BOMB {aka struct Bomb} main.c:10:13: note: expected 'BOMB *' {aka 'struct Bomb *'} but argument is of type 'BOMB' {aka 'struct Bomb'} 10 | void Output(BOMB *); | ^~~~~~ main.c: At top level: main.c:38:1: error: return type defaults to 'int' [-Wimplicit-int] 38 | Input(BOMB *bomb_ptr) | ^~~~~ main.c:38:1: warning: conflicting types for 'Input' main.c:9:6: note: previous declaration of 'Input' with type 'void(BOMB *)' {aka 'void(struct Bomb *)'} 9 | void Input(BOMB *); | ^~~~~ main.c:50:1: error: return type defaults to 'int' [-Wimplicit-int] 50 | Output(BOMB *bomb_ptr) | ^~~~~~ main.c:50:1: warning: conflicting types for 'Output' main.c:10:6: note: previous declaration of 'Output' with type 'void(BOMB *)' {aka 'void(struct Bomb *)'} 10 | void Output(BOMB *); | ^~~~~~ main.c:61:6: error: conflicting types for 'explode'; have 'void(BOMB *)' {aka 'void(struct Bomb *)'} 61 | void explode(BOMB *bomb_ptr) | ^~~~~~~ main.c:11:6: note: previous declaration of 'explode' with type 'void(BOMB)' {aka 'void(struct Bomb)'} 11 | void explode(BOMB); | ^~~~~~~
s670298350
p00071
C
#include <stdio.h> #include <stdlib.h> typedef struct Bomb{ int map[8][8]; } BOMB; Input(BOMB *); void explode(BOMB *); int x_cnt, y_cnt; int main() { int input_times, input_cnt; BOMB Bomb[50]; int x, y; scanf("%d", &input_times); for(input_cnt = 0; input_cnt < input_times; input_cnt++){ Input(&Bomb[input_cnt]); scanf("%d\n%d", &x, &y); Bomb[input_cnt].map[x - 1][y - 1] = 2; explode(&Bomb[input_cnt]); } for(input_cnt = 0; input_cnt < input_times; input_cnt++){ printf("Data %d:\n", input_cnt + 1); for(y_cnt = 0; y_cnt < 8; y_cnt++){ for(x_cnt = 0; x_cnt < 8; x_cnt++) printf("%d", Bomb[input_cnt].map[x_cnt][y_cnt]); printf("\n"); } } return 0; } Input(BOMB *bomb) { char dump; dump = getchar(); for(y_cnt = 0; y_cnt < 8; y_cnt++){ dump = getchar(); for(x_cnt = 0; x_cnt < 8; x_cnt++) bomb->map[x_cnt][y_cnt] = getchar() - 48; } } void explode(BOMB* bomb_map) { int explode_cnt; for(y_cnt = 0; y_cnt < 8; y_cnt++) for(x_cnt = 0; x_cnt < 8; x_cnt++) /*Find exploded bomb and process*/ if(bomb_map->map[x_cnt][y_cnt] == 2){ bomb_map->map[x_cnt][y_cnt] = 0; *Left*/ explode_cnt = 1; while((x_cnt - explode_cnt) >= 0 && explode_cnt <= 3){ if((bomb_map->map[x_cnt - explode_cnt][y_cnt]) == 1) (bomb_map->map[x_cnt - explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Right*/ explode_cnt = 1; while((x_cnt + explode_cnt) <= 7 && explode_cnt <= 3){ if((bomb_map->map[x_cnt + explode_cnt][y_cnt]) == 1) (bomb_map->map[x_cnt + explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Down*/ explode_cnt = 1; while((y_cnt - explode_cnt) >= 0 && explode_cnt <= 3){ if((bomb_map->map[x_cnt][y_cnt - explode_cnt]) == 1) (bomb_map->map[x_cnt][y_cnt - explode_cnt]) = 2; explode_cnt++; } /*Up*/ explode_cnt = 1; while((y_cnt + explode_cnt) <= 7 && explode_cnt <= 3){ if((bomb_map->map[x_cnt][y_cnt + explode_cnt]) == 1) (bomb_map->map[x_cnt][y_cnt + explode_cnt]) = 2; explode_cnt++; } explode(bomb_map); } }
main.c:8:1: warning: data definition has no type or storage class 8 | Input(BOMB *); | ^~~~~ main.c:8:1: error: type defaults to 'int' in declaration of 'Input' [-Wimplicit-int] main.c:39:1: error: return type defaults to 'int' [-Wimplicit-int] 39 | Input(BOMB *bomb) | ^~~~~ main.c: In function 'explode': main.c:58:34: error: 'Left' undeclared (first use in this function) 58 | *Left*/ | ^~~~ main.c:58:34: note: each undeclared identifier is reported only once for each function it appears in main.c:58:39: error: expected expression before '/' token 58 | *Left*/ | ^
s775247743
p00071
C
#include <stdio.h> #include <stdlib.h> typedef struct Bomb{ int map[8][8]; } BOMB; void Input(BOMB *); void Output(BOMB); void explode(BOMB *); int x_cnt, y_cnt; int main() { int input_times, input_cnt; BOMB Bomb[50]; int x, y; scanf("%d", &input_times); for(input_cnt = 0; input_cnt < input_times; input_cnt++){ Input(&Bomb[input_cnt]); scanf("%d\n%d", &x, &y); Bomb[input_cnt].map[x - 1][y - 1] = 2; explode(&Bomb[input_cnt]); } for(input_cnt = 0; input_cnt < input_times; input_cnt++){ printf("Data %d:\n", input_cnt + 1); } return 0; } void Input(BOMB *bomb) { char dump; dump = getchar(); for(y_cnt = 0; y_cnt < 8; y_cnt++){ dump = getchar(); for(x_cnt = 0; x_cnt < 8; x_cnt++) bomb->map[x_cnt][y_cnt] = getchar() - 48; } } void Output(BOMB) { for(y_cnt = 0; y_cnt < 8; y_cnt++){ for(x_cnt = 0; x_cnt < 8; x_cnt++) printf("%d", Bomb[input_cnt].map[x_cnt][y_cnt]); printf("\n"); } } void explode(BOMB* bomb_map) { int explode_cnt; for(y_cnt = 0; y_cnt < 8; y_cnt++) for(x_cnt = 0; x_cnt < 8; x_cnt++) /*Find exploded bomb and process*/ if(bomb_map->map[x_cnt][y_cnt] == 2){ bomb_map->map[x_cnt][y_cnt] = 0; /*Left*/ explode_cnt = 1; while((x_cnt - explode_cnt) >= 0 && explode_cnt <= 3){ if((bomb_map->map[x_cnt - explode_cnt][y_cnt]) == 1) (bomb_map->map[x_cnt - explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Right*/ explode_cnt = 1; while((x_cnt + explode_cnt) <= 7 && explode_cnt <= 3){ if((bomb_map->map[x_cnt + explode_cnt][y_cnt]) == 1) (bomb_map->map[x_cnt + explode_cnt][y_cnt]) = 2; explode_cnt++; } /*Down*/ explode_cnt = 1; while((y_cnt - explode_cnt) >= 0 && explode_cnt <= 3){ if((bomb_map->map[x_cnt][y_cnt - explode_cnt]) == 1) (bomb_map->map[x_cnt][y_cnt - explode_cnt]) = 2; explode_cnt++; } /*Up*/ explode_cnt = 1; while((y_cnt + explode_cnt) <= 7 && explode_cnt <= 3){ if((bomb_map->map[x_cnt][y_cnt + explode_cnt]) == 1) (bomb_map->map[x_cnt][y_cnt + explode_cnt]) = 2; explode_cnt++; } explode(bomb_map); } }
main.c: In function 'Output': main.c:53:38: error: 'Bomb' undeclared (first use in this function) 53 | printf("%d", Bomb[input_cnt].map[x_cnt][y_cnt]); | ^~~~ main.c:53:38: note: each undeclared identifier is reported only once for each function it appears in main.c:53:43: error: 'input_cnt' undeclared (first use in this function) 53 | printf("%d", Bomb[input_cnt].map[x_cnt][y_cnt]); | ^~~~~~~~~
s674581430
p00071
C
int a[8][8]; void f(int x, int y) { a[x][y]=0; for(int i=1;i<=3;i++) { if(x+i>7) break; if(a[x+i][y]) f(x+i,y); } for(int i=1;i<=3;i++) { if(x-i<0) break; if(a[x-i][y]) f(x-i,y); } for(int i=1;i<=3;i++) { if(y+i>7) break; if(a[x][y+i]) f(x,y+i); } for(int i=1;i<=3;i++) { if(y-i<0) break; if(a[x][y-i]) f(x,y-i); } } void solve(int x, int y) { f(x,y); REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); } int main() { int n; cin >> n; string s; FOR(c,1,n) { REP(i,8) { cin >> s; REP(j,8) a[i][j] = s[j]-'0'; } int a,b; cin >> a >> b; printf("Data %d:\n",c); solve(--b,--a); } return 0; }
main.c: In function 'solve': main.c:31:3: error: implicit declaration of function 'REP' [-Wimplicit-function-declaration] 31 | REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); | ^~~ main.c:31:7: error: 'i' undeclared (first use in this function) 31 | REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); | ^ main.c:31:7: note: each undeclared identifier is reported only once for each function it appears in main.c:31:11: error: expected ';' before 'REP' 31 | REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); | ^~~ | ; main.c: In function 'main': main.c:36:10: error: 'cin' undeclared (first use in this function) 36 | int n; cin >> n; | ^~~ main.c:37:3: error: unknown type name 'string' 37 | string s; | ^~~~~~ main.c:38:3: error: implicit declaration of function 'FOR' [-Wimplicit-function-declaration] 38 | FOR(c,1,n) | ^~~ main.c:38:7: error: 'c' undeclared (first use in this function) 38 | FOR(c,1,n) | ^ main.c:38:13: error: expected ';' before '{' token 38 | FOR(c,1,n) | ^ | ; 39 | { | ~
s691414460
p00071
C
#include<stdio.h> #include<string.h> char m[10][10]; int n,j,k,x,y,g=0; int main(){ scanf("%d\n\n",&n); while(n--){g++; for(int i=0;i<8;i++)scanf("%8s\n",m[i]); scanf("%d\n%d\n\n",&x,&y); m[y-1][x-1]='0'; ex(y-1,x-1); printf("Data %d:\n",g); for(int i=0;i<8;i++)printf("%s\n",m[i]); } return 0; }
main.c: In function 'main': main.c:13:17: error: implicit declaration of function 'ex' [-Wimplicit-function-declaration] 13 | ex(y-1,x-1); | ^~
s212685336
p00071
C++
gets.to_i.times{|n| gets m=(1..8).map{gets} q=[[gets.to_i-1,gets.to_i-1]] while q!=[] x,y=q.pop x<8&&x>=0&&y<8&&y>=0&&m[y][x]>?0&&( m[y][x]=?0 q.push *(-3..3).flat_map{|i|[[x,y+i],[x+i,y]]} ) end puts "Data #{n+1}:",m }
a.cc:3:4: error: too many decimal points in number 3 | m=(1..8).map{gets} | ^~~~ a.cc:9:11: error: too many decimal points in number 9 | q.push *(-3..3).flat_map{|i|[[x,y+i],[x+i,y]]} | ^~~~ a.cc:1:1: error: 'gets' does not name a type 1 | gets.to_i.times{|n| | ^~~~
s510443342
p00071
C++
import std.stdio, std.string, std.conv; import std.array, std.algorithm, std.range; void main() { immutable N = 8; immutable n = readln().chomp().to!int(); foreach(i;0..n) { readln(); auto m = iota(N).map!(_=>readln.chomp().to!(char[])()).array(); immutable x = readln().chomp().to!int(); immutable y = readln().chomp().to!int(); void dfs(int x, int y) { if(x<0 || N<=x || y<0 || N<=y || m[y][x]=='0') return; m[y][x]='0'; foreach(d;[[1,0],[-1,0],[0,1],[0,-1]]) foreach(k;1..4) dfs(x+d[0]*k,y+d[1]*k); } dfs(x-1,y-1); writeln("Data ",i+1,":"); m.join("\n").writeln(); } }
a.cc:8:15: error: too many decimal points in number 8 | foreach(i;0..n) | ^~~~ a.cc:19:27: error: too many decimal points in number 19 | foreach(k;1..4) | ^~~~ a.cc:1:1: error: 'import' does not name a type 1 | import std.stdio, std.string, std.conv; | ^~~~~~ 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 std.array, std.algorithm, std.range; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: '::main' must return 'int' 4 | void main() | ^~~~ a.cc: In function 'int main()': a.cc:6:5: error: 'immutable' was not declared in this scope; did you mean 'mutable'? 6 | immutable N = 8; | ^~~~~~~~~ | mutable a.cc:7:14: error: expected ';' before 'n' 7 | immutable n = readln().chomp().to!int(); | ^~ | ; a.cc:8:13: error: 'i' was not declared in this scope 8 | foreach(i;0..n) | ^
s986938869
p00071
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define FOR(i, s, n) for(int i = s; i <= (int)n; ++i) #define per(i, n) for(int i = n; i > 0; i--) #define ROF(i, s, n) for(int i = s; i >= (int)n; i--) #define FORIT(i, A) for (auto i : A) #define PRINT(x) cout << (x) << "\n" #define MP make_pair #define PB push_back #define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i) #define SZ(a) int((a).size()) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define CLR(a) memset((a), 0 ,sizeof(a)) #define NCLR(a) memset((a), -1 ,sizeof(a)) #define int long long typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> P; typedef vector<int> VLL; typedef vector<int> VVLL; typedef unsigned int uint; typedef priority_queue<int> maxque; typedef priority_queue< int, vector<int>, greater<int> > minque; static const double EPS = 1e-10; static const double PI = acos( -1.0 ); static const int mod = 1000000007; static const int INF = 1 << 29; static const int LL_INF = 1ll << 60; static const int dx[] = { -1, 0, 1, 0 }; static const int dy[] = { 0, -1, 0, 1 }; char feld[10][10]; int n; void boms(int x,int y){ if(feld[y][x]=='0')return; feld[y][x]='0'; for(int i=1;i<=3;++i){ rep(j,4){ int nx=x+(dx[j]*i); int ny=y+(dy[j]*i); if(nx>8||nx<=0||ny>8||ny<=0)continue; boms(nx,ny); } } } signed main(){ cin>>n; for(int i=1;i<=n;++i){ for(int y=1;y<=8;++y){ for(int x=1;x<=8;++x){ cin>>feld[y][x]; } } int a,b; cin>>a>>b; boms(a,b); cout<<"Data "<<i<<":"<<endl; for(int y=1;y<=8;++y){ for(int x=1;x<=8;++x)cout<<feld[y][x]; cout<<"\n"; } } }
a.cc:24:22: error: conflicting declaration 'typedef long long unsigned int uint' 24 | typedef unsigned int uint; | ^~~~ In file included from /usr/include/stdlib.h:514, from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint' 150 | typedef unsigned int uint; | ^~~~
s509671144
p00071
C++
#include <bits/stdc++.h> using namespace std; char bomb[8][8]; void printData(int i) { cout << "Data " << i+1 << ':' << endl; } void dfs(int x, int y) { bomb[y][x] = '0'; for (int i = x-3; i <= x+3; i++) { if ((0 <= i && i <= 7) && bomb[y][i] == '1') dfs(i, y); } for (int j = y-3; j <= y+3; j++) { if ((0 <= j && j <= 7) && bomb[j][x] == '1') dfs(x, j); } } int main() { int n, x, y; string str; cin >> n; for (int i = 0; i < n; i++) { string tmp; for (int j = 0; j < 8; j++) { cin >> str; tmp += str; } int t = 0; for (int j = 0; j < 8; j++) { for (int k = 0; k < 8; k++) { bomb[j][k] = tmp[t++]; cin >> x >> y; printData(i); dfs(x-1, y-1); for (int j = 0; j < 8; j++) { for (int k = 0; k < 8; k++) { cout << bomb[j][k]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:55:2: error: expected '}' at end of input 55 | } | ^ a.cc:30:33: note: to match this '{' 30 | for (int i = 0; i < n; i++) { | ^ a.cc:55:2: error: expected '}' at end of input 55 | } | ^ a.cc:25:1: note: to match this '{' 25 | { | ^
s812139668
p00071
C++
#include<iostream> #include<cstdio> using namespace std; int dfs(int x,int y); char maps[8][8]; int dx[12]={-1,-2,-3,1,2,3,0,0,0,0,0,0}; int dy[12]={0,0,0,0,0,0,-1,-2,-3,1,2,3}; int strx[65]={0}; int stry[65]={0}; int k=0; int main(){ int n,sx,sy,cas; cin >> n; for(cas=1;cas<=n;cas++){ for(int i=0;i<8;i++){ for(int j=0;j<8;j++){ cin >> maps[i][j]; } } cin >> sx >> sy; dfs(sx-1,sy-1); printf("Data %d:\n",cas); for(int i=0;i<8;i++){ for(int j=0;j<8;j++){ cout << maps[i][j]; } cout << endl; } } return 0; } int dfs(int x,int y){ int nx,ny; for(int j=0;j<64;j++){ strx[j]=strx[j+1]; stry[j]=stry[j+1]; } if(k!=0){ k--; } strx[64]=0; stry[64]=0; } for(int i=0;i<12;i++){ nx=x+dx[i]; ny=y+dy[i]; maps[y][x]='0'; if(0<=nx && nx<8 && 0<=ny && ny<8 && maps[ny][nx]=='1'){ strx[k]=nx; stry[k]=ny; k++; } } if(strx[0]==0) return 0; dfs(strx[0],stry[0]); }
a.cc: In function 'int dfs(int, int)': a.cc:48:3: warning: no return statement in function returning non-void [-Wreturn-type] 48 | } | ^ a.cc: At global scope: a.cc:49:3: error: expected unqualified-id before 'for' 49 | for(int i=0;i<12;i++){ | ^~~ a.cc:49:15: error: 'i' does not name a type 49 | for(int i=0;i<12;i++){ | ^ a.cc:49:20: error: 'i' does not name a type 49 | for(int i=0;i<12;i++){ | ^ a.cc:59:3: error: expected unqualified-id before 'if' 59 | if(strx[0]==0) return 0; | ^~ a.cc:60:6: error: expected constructor, destructor, or type conversion before '(' token 60 | dfs(strx[0],stry[0]); | ^ a.cc:61:1: error: expected declaration before '}' token 61 | } | ^
s342516038
p00071
C++
#include<iostream> #include<cstdio> using namespace std; int dfs(int x,int y); char maps[8][8]; int dx[12]={-1,-2,-3,1,2,3,0,0,0,0,0,0}; int dy[12]={0,0,0,0,0,0,-1,-2,-3,1,2,3}; int strx[65]={0}; int stry[65]={0}; int k=0; int main(){ int n,sx,sy,cas; cin >> n; for(cas=1;cas<=n;cas++){ for(int i=0;i<8;i++){ for(int j=0;j<8;j++){ cin >> maps[i][j]; } } cin >> sx >> sy; dfs(sx-1,sy-1); printf("Data %d:\n",cas); for(int i=0;i<8;i++){ for(int j=0;j<8;j++){ cout << maps[i][j]; } cout << endl; } } return 0; } int dfs(int x,int y){ int nx,ny; for(int j=0;j<64;j++){ strx[j]=strx[j+1]; stry[j]=stry[j+1]; } if(k!=0){ k--; } strx[64]=0; stry[64]=0; } for(int i=0;i<12;i++){ nx=x+dx[i]; ny=y+dy[i]; maps[y][x]='0'; if(0<=nx && nx<8 && 0<=ny && ny<8 && maps[ny][nx]=='1'){ strx[k]=nx; stry[k]=ny; k++; } } if(strx[0]==0) return 0; dfs(strx[0],stry[0]); }
a.cc: In function 'int dfs(int, int)': a.cc:48:3: warning: no return statement in function returning non-void [-Wreturn-type] 48 | } | ^ a.cc: At global scope: a.cc:49:3: error: expected unqualified-id before 'for' 49 | for(int i=0;i<12;i++){ | ^~~ a.cc:49:15: error: 'i' does not name a type 49 | for(int i=0;i<12;i++){ | ^ a.cc:49:20: error: 'i' does not name a type 49 | for(int i=0;i<12;i++){ | ^ a.cc:59:3: error: expected unqualified-id before 'if' 59 | if(strx[0]==0) return 0; | ^~ a.cc:60:6: error: expected constructor, destructor, or type conversion before '(' token 60 | dfs(strx[0],stry[0]); | ^ a.cc:61:1: error: expected declaration before '}' token 61 | } | ^
s278678495
p00071
C++
#define REP(i,n) for (int i=0;i<(n);i++)??? #include <iostream> using namespace std; const int MAX = 8; int set,n; int sx,sy; char field[MAX][MAX]; int dx[12] = {1, 0, -1, 0, 2, 0, -2, 0, 3, 0, -3, 0};??? int dy[12] = {0, 1, 0, -1, 0, 2, 0, -2, 0, 3, 0, -3}; void dfs (int x,int y){ field[x][y] = '0'; REP(i,12){ int nx = x + dx[i], ny = y + dy[i]; if (0 <= nx && nx < MAX && 0 <= ny && ny < MAX && field[nx][ny] == '1') dfs(nx,ny); } return ; } void solve(){ dfs(sy,sx); REP(i,MAX){ REP(j,MAX){ cout << field[i][j]; } cout << endl; } } int main(){ cin >> n; REP(set,n){ REP(i,MAX){ REP(j,MAX){ cin >> field[i][j]; } } cin >> sx >> sy; sx --; sy --; cout << "Data " << set+1 << ":" << endl; solve(); } }
a.cc:12:54: error: expected unqualified-id before '?' token 12 | int dx[12] = {1, 0, -1, 0, 2, 0, -2, 0, 3, 0, -3, 0};??? | ^ a.cc: In function 'void dfs(int, int)': a.cc:1:41: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:18:9: note: in expansion of macro 'REP' 18 | REP(i,12){ | ^~~ a.cc:1:42: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:18:9: note: in expansion of macro 'REP' 18 | REP(i,12){ | ^~~ a.cc:1:43: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:18:9: note: in expansion of macro 'REP' 18 | REP(i,12){ | ^~~ a.cc:18:18: error: expected primary-expression before '{' token 18 | REP(i,12){ | ^ a.cc:18:18: error: expected ':' before '{' token a.cc:18:18: error: expected primary-expression before '{' token a.cc:18:18: error: expected ':' before '{' token a.cc:18:18: error: expected primary-expression before '{' token a.cc:18:18: error: expected ':' before '{' token a.cc:18:18: error: expected primary-expression before '{' token a.cc: In function 'void solve()': a.cc:1:41: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:29:9: note: in expansion of macro 'REP' 29 | REP(i,MAX){ | ^~~ a.cc:1:42: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:29:9: note: in expansion of macro 'REP' 29 | REP(i,MAX){ | ^~~ a.cc:1:43: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:29:9: note: in expansion of macro 'REP' 29 | REP(i,MAX){ | ^~~ a.cc:29:19: error: expected primary-expression before '{' token 29 | REP(i,MAX){ | ^ a.cc:29:19: error: expected ':' before '{' token a.cc:29:19: error: expected primary-expression before '{' token a.cc:29:19: error: expected ':' before '{' token a.cc:29:19: error: expected primary-expression before '{' token a.cc:29:19: error: expected ':' before '{' token a.cc:29:19: error: expected primary-expression before '{' token a.cc: In function 'int main()': a.cc:1:41: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:39:9: note: in expansion of macro 'REP' 39 | REP(set,n){ | ^~~ a.cc:1:42: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:39:9: note: in expansion of macro 'REP' 39 | REP(set,n){ | ^~~ a.cc:1:43: error: expected primary-expression before '?' token 1 | #define REP(i,n) for (int i=0;i<(n);i++)??? | ^ a.cc:39:9: note: in expansion of macro 'REP' 39 | REP(set,n){ | ^~~ a.cc:39:19: error: expected primary-expression before '{' token 39 | REP(set,n){ | ^ a.cc:39:19: error: expected ':' before '{' token a.cc:39:19: error: expected primary-expression before '{' token a.cc:39:19: error: expected ':' before '{' token a.cc:39:19: error: expected primary-expression before '{' token a.cc:39:19: error: expected ':' before '{' token a.cc:39:19: error: expected primary-expression before '{' token
s455040605
p00071
C++
int a[8][8]; void f(int x, int y) { a[x][y]=0; for(int i=1;i<=3;i++) { if(x+i>7) break; if(a[x+i][y]) f(x+i,y); } for(int i=1;i<=3;i++) { if(x-i<0) break; if(a[x-i][y]) f(x-i,y); } for(int i=1;i<=3;i++) { if(y+i>7) break; if(a[x][y+i]) f(x,y+i); } for(int i=1;i<=3;i++) { if(y-i<0) break; if(a[x][y-i]) f(x,y-i); } } void solve(int x, int y) { f(x,y); REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); } int main() { int n; cin >> n; string s; FOR(c,1,n) { REP(i,8) { cin >> s; REP(j,8) a[i][j] = s[j]-'0'; } int a,b; cin >> a >> b; printf("Data %d:\n",c); solve(--b,--a); } return 0; }
a.cc: In function 'void solve(int, int)': a.cc:31:7: error: 'i' was not declared in this scope 31 | REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); | ^ a.cc:31:3: error: 'REP' was not declared in this scope 31 | REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":"")); | ^~~ a.cc: In function 'int main()': a.cc:36:10: error: 'cin' was not declared in this scope 36 | int n; cin >> n; | ^~~ a.cc:37:3: error: 'string' was not declared in this scope 37 | string s; | ^~~~~~ a.cc:38:7: error: 'c' was not declared in this scope 38 | FOR(c,1,n) | ^ a.cc:38:3: error: 'FOR' was not declared in this scope 38 | FOR(c,1,n) | ^~~
s581734849
p00071
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <string> #include <map> using namespace std; #define ll long long #define rep(i,n) for(int i=0;i<n;i++) #define ld long double #define forever while(true) int vx[13]={-3,-2,-1,0,0,0,0,0,0,0,1,2,3}; int vy[13]={0,0,0,0,-3,-2,-1,1,2,3,0,0,0}; int a[8][8]; int blow(int x,int y) { a[x][y]=0; rep(i,13){ int nextx=x+vx[i]; int nexty=y+vy[i]; if(nextx<0||8<=nextx||nexty<0||8<=nexty){ continue; } if(a[nextx][nexty]==1) { int u= blow(nextx,nexty); } a[next][nexty]=0; } return 0; } int main(){ int n; cin>>n; rep(i,n){ rep(i1,8){ rep(i2,8){ cin>>a[i1][i2]; } } int x,y; cin>>x>>y; x--; y--; int u=blow(x,y); for(int i=0;i<8;i++) { for(int j=0;j<8;j++){ cout<<a[i][j]; } cout<<endl; } } return 0; }
a.cc: In function 'int blow(int, int)': a.cc:29:8: error: invalid types 'int [8][8][<unresolved overloaded function type>]' for array subscript 29 | a[next][nexty]=0; | ^
s676032695
p00071
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <string> #include <map> using namespace std; #define ll long long #define rep(i,n) for(int i=0;i<n;i++) #define ld long double #define forever while(true) int vx[13]={-3,-2,-1,0,0,0,0,0,0,0,1,2,3}; int vy[13]={0,0,0,0,-3,-2,-1,1,2,3,0,0,0}; int a[8][8]; int blow(int x,int y) { a[x][y]=0; rep(i,13){ int nextx=x+vx[i]; int nexty=y+vy[i]; if(nextx<0||8<=nextx||nexty<0||8<=nexty){ continue; } if(a[nextx][nexty]==1) { int u= blow(nextx,nexty); } a[nextx][nexty]=0; } return 0; } int main(){ int n; cin>>n; while(n—){ rep(i1,8){ rep(i2,8){ cin>>a[i1][i2]; } } int x,y; cin>>x>>y; x--; y--; int u=blow(x,y); for(int k=0;k<8;k++) { for(int j=0;j<8;j++){ cout<<a[k][j]; } cout<<endl; } } return 0; }
a.cc:37:9: error: extended character — is not valid in an identifier 37 | while(n—){ | ^ a.cc: In function 'int main()': a.cc:37:9: error: 'n\U00002014' was not declared in this scope 37 | while(n—){ | ^~
s829663761
p00071
C++
Last login: Sat May 26 19:20:24 on ttys002 Risa-no-MacBook:~ Risa$ cd Desktop/ Risa-no-MacBook:Desktop Risa$ cd programming/ Risa-no-MacBook:programming Risa$ mkdir 0226 Risa-no-MacBook:programming Risa$ cd 0 0226/ 0416/ 0417/ 0423/ 0424/ 0501/ 0507/ 0508/ 0514/ 0515/ 0521/ 0522/ Risa-no-MacBook:programming Risa$ rmdir 0226/ Risa-no-MacBook:programming Risa$ mkdir 0528 Risa-no-MacBook:programming Risa$ cd 0528/ Risa-no-MacBook:0528 Risa$ emacs 0226.cpp Risa-no-MacBook:0528 Risa$ emacs 0226.cpp Risa-no-MacBook:0528 Risa$ emacs 0064.cpp Risa-no-MacBook:0528 Risa$ emacs 0064.cpp Risa-no-MacBook:0528 Risa$ emacs 0064.cpp Risa-no-MacBook:0528 Risa$ cd ../ Risa-no-MacBook:programming Risa$ mkdir 0529 Risa-no-MacBook:programming Risa$ cd 0529 Risa-no-MacBook:0529 Risa$ emacs 0533.cpp Risa-no-MacBook:0529 Risa$ emacs 0071.cpp #include <iostream> using namespace std; char g[8][8]; void solve(int a, int b) { g[a][b] = '0'; for(int i = 1; i <= 3; i++) { if(a+i < 8 && g[a+i][b] == '1') { g[a+i][b] = '0'; solve(a+i, b); } if(a-i >= 0 && g[a-i][b] == '1') { g[a-i][b] = '0'; solve(a-i, b); } if(b+i < 8 && g[a][b+i] == '1') { g[a][b+i] = '0'; solve(a, b+i); } if(b-i >= 0 && g[a][b-i] == '1') { g[a][b-i] = '0'; solve(a, b-i); } } } int main() { int n, X, Y; int k = 0; cin >> n; while(n > k) { for(int i = 0; i < 8; i++) { for(int j = 0; j < 8; j++) { cin >> g[i][j]; } } cin >> X >> Y; X--; Y--; solve(Y, X); cout << "Data " << (k+1) << ':' << endl; for(int i = 0; i < 8; i++) { for(int j = 0; j < 8; j++) { cout << g[i][j]; } cout << '\n'; } k++; } return 0; }
a.cc:6:43: error: invalid digit "8" in octal constant 6 | 0226/ 0416/ 0417/ 0423/ 0424/ 0501/ 0507/ 0508/ 0514/ 0515/ 0521/ 0522/ | ^~~~ a.cc:8:41: error: invalid digit "8" in octal constant 8 | Risa-no-MacBook:programming Risa$ mkdir 0528 | ^~~~ a.cc:9:38: error: invalid digit "8" in octal constant 9 | Risa-no-MacBook:programming Risa$ cd 0528/ | ^~~~ a.cc:10:17: error: invalid digit "8" in octal constant 10 | Risa-no-MacBook:0528 Risa$ emacs 0226.cpp | ^~~~ a.cc:32:17: error: invalid digit "8" in octal constant 32 | Risa-no-MacBook:0528 Risa$ emacs 0226.cpp | ^~~~ a.cc:33:17: error: invalid digit "8" in octal constant 33 | Risa-no-MacBook:0528 Risa$ emacs 0064.cpp | ^~~~ a.cc:34:17: error: invalid digit "8" in octal constant 34 | Risa-no-MacBook:0528 Risa$ emacs 0064.cpp | ^~~~ a.cc:35:17: error: invalid digit "8" in octal constant 35 | Risa-no-MacBook:0528 Risa$ emacs 0064.cpp | ^~~~ a.cc:36:17: error: invalid digit "8" in octal constant 36 | Risa-no-MacBook:0528 Risa$ cd ../ | ^~~~ a.cc:37:41: error: invalid digit "9" in octal constant 37 | Risa-no-MacBook:programming Risa$ mkdir 0529 | ^~~~ a.cc:38:38: error: invalid digit "9" in octal constant 38 | Risa-no-MacBook:programming Risa$ cd 0529 | ^~~~ a.cc:39:17: error: invalid digit "9" in octal constant 39 | Risa-no-MacBook:0529 Risa$ emacs 0533.cpp | ^~~~ a.cc:40:17: error: invalid digit "9" in octal constant 40 | Risa-no-MacBook:0529 Risa$ emacs 0071.cpp | ^~~~ a.cc:1:1: error: 'Last' does not name a type 1 | Last login: Sat May 26 19:20:24 on ttys002 | ^~~~ 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:46: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); |
s916083911
p00071
C++
//0071 #include<stdio.h> #include<algorithm> using namespace std; const int N = 8; char board[N][N+2]; void Fire(int i, int j) { if(board[i][j] != '1') return; board[i][j] = '0'; int d; for(d = max(j-3, 0); d < min(j+4, N); ++d) { Fire(i, d); } for(d = max(i-3, 0); d < min(i+4, N); ++d) { Fire(d, j); } } int main(void) { int n; scanf("%d", &n); int i; for(int caseNum = 1; caseNum <= n; ++caseNum) { for(i = 0; i < N; ++i) { gets(board[i]); if(board[i][0] == '\0') --i; } int x, y; scanf("%d %d", &x, &y); Fire(y-1, x-1); printf("Data %d:\n", caseNum); for(i = 0; i < N; ++i) { puts(board[i]); } } return 0; }
a.cc: In function 'int main()': a.cc:35:25: error: 'gets' was not declared in this scope; did you mean 'getw'? 35 | gets(board[i]); | ^~~~ | getw
s123745392
p00071
C++
#include <iostream> using namespace std; char field[14][14]; int dx[12] = {-3, -2, -1, 0, 0, 0, 0, 0, 0, 1, 2, 3}; int dy[12] = { 0, 0, 0, 1, 2, 3, -1, -2, -3, 0, 0, 0}; void DFS(int y, int x) { field[y][x] = '0'; for(int i = 0; i < 12; ++i) { int X = x + dx[i]; int Y = y + dy[i]; if((3 <= X && X <= 10 && 3 <= Y && Y <= 10) && field[Y][X] == '1') { DFS(Y, X); } } } void solve() { int n; cin >> n; int count = 0; while(n--) { count++; memset(field, 0, sizeof(field)); for(int i = 3; i < 11; ++i) { for(int j = 3; j < 11; ++j) { cin >> field[i][j]; } } int x, y; cin >> x >> y; DFS(y + 2, x + 2); cout << "Data " << count << ":" << endl; for(int i = 3; i < 11; ++i) { for(int j = 3; j < 11; ++j) { cout << field[i][j]; } cout << endl; } } } int main() { solve(); return(0); }
a.cc: In function 'void solve()': a.cc:30:17: error: 'memset' was not declared in this scope 30 | memset(field, 0, sizeof(field)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 |
s689115093
p00071
C++
#include<stdio.h> #include<iostream> char map[8][9]; int start[2]; void explosion(int x,int y){ int ai; map[x][y]='0'; int j,k; for(i=-3;i<4;i++){ if((x+i>=0)&&(x+i<9)&&(map[x+i][y]=='1')){ explosion(x+i,y); } if((y+i>=0)&&(y+i<9)&&(map[x][y+i]=='1')){ explosion(x,y+i); } } return; } int main(){ int n; scanf("%d",&n); int i,j,k; for(i=1;i<n+1;i++){ for(j=0;j<8;j++){ scanf(" %s",&map[j]); scanf("%d %d",&start[0],&start[1]); if(map[start[1]-1][start[0]-1]=='1')explosion(start[1]-1,start[0]-1); printf("Data %d:\n",i); for(j=0;j<8;j++){ for(k=0;k<8;k++){ putchar(map[j][k]); } printf("\n"); } } }
a.cc: In function 'void explosion(int, int)': a.cc:9:13: error: 'i' was not declared in this scope 9 | for(i=-3;i<4;i++){ | ^ a.cc: In function 'int main()': a.cc:37:2: error: expected '}' at end of input 37 | } | ^ a.cc:19:11: note: to match this '{' 19 | int main(){ | ^
s601431194
p00071
C++
#include <iostream> using namespace std; bool field[9][9]; void vis(int x, int y){ if(x<0 || 8<x || y<0 || 8<y || field[y][x]==0){ return; } if(field[y][x]==1){ field[y][x]=0; for(int t=1; t<=3; ++t){ vis(x+t, y); vis(x-t, y); vis(x, y+t); vis(x, y-t); } } return; } int main(){ int n, x, y; cin>>n; while(n--){ for(int j=0; j<8; ++j){ for(int i=0; i<8; ++i){ char c; cin>>c; field[y][x]=c=='1'; } } cin>>x>>y; vis(x, y); for(int j=0; j<8; ++j){ for(int i=0; i<8; ++i){ cout<<field[y][x]; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:61:2: error: expected '}' at end of input 61 | } | ^ a.cc:31:11: note: to match this '{' 31 | int main(){ | ^
s275068121
p00071
C++
//まともに使い方を理解していないくせにincludeしまくる人間のクズ #include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <cctype> #include <vector> #include <algorithm> #include <stack> #include <queue> #include <list> #include <set> #include <map> #include <bitset> //using namespace stdしないと表記がめんどくさいからね、仕方ないね using namespace std; //可読性を上げるためのdefineが仇となる典型的パターン #define rep(i,n) for(int i = 0; i < n; i++) //ローカル変数とグローバル変数は使い分けよう! short n, x, y, j, k; short planar[14][14]; int s; unsigned long long int ans; //関数って楽しいよね!(魔王スマイル) void bom(short c, short d) { planar[c][d] = 0; if (planar[c + 1][d] != 0) bom(c + 1, d); if (planar[c - 1][d] != 0) bom(c - 1, d); if (planar[c][d + 1] != 0) bom(c, d + 1); if (planar[c][d - 1] != 0) bom(c, d - 1); if (planar[c + 2][d] != 0) bom(c + 2, d); if (planar[c - 2][d] != 0) bom(c - 2, d); if (planar[c][d + 2] != 0) bom(c, d + 2); if (planar[c][d - 2] != 0) bom(c, d - 2); if (planar[c - 3][d] != 0) bom(c - 3, d); if (planar[c + 3][d] != 0) bom(c + 3, d); if (planar[c][d + 3] != 0) bom(c, d + 3); if (planar[c][d - 3] != 0) bom(c, d - 3); return; } } int main() { rep(i, 14) { planar[i][0] = 0; planar[i][1] = 0; planar[i][2] = 0; planar[i][11] = 0; planar[i][12] = 0; planar[i][13] = 0; planar[0][i] = 0; planar[1][i] = 0; planar[2][i] = 0; planar[11][i] = 0; planar[12][i] = 0; planar[13][i] = 0; } scanf("%d", &n); rep(i, n) { scanf("\n"); for (j = 3; j <= 10; j++) for (k = 3; k <= 10; k++) scanf("%1d", &planar[j][k]); scanf("%d", &x); scanf("%d", &y); bom(y + 2, x + 2); printf("Data %d:\n", i + 1); for (j = 3; j <= 10; j++) { for (k = 3; k <= 10; k++) { printf("%d", planar[j][k]); } printf("\n"); } } return 0; }
a.cc:59:1: error: expected declaration before '}' token 59 | } | ^
s000442767
p00071
C++
//まともに使い方を理解していないくせにincludeしまくる人間のクズ #include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <cctype> #include <vector> #include <algorithm> #include <stack> #include <queue> #include <list> #include <set> #include <map> #include <bitset> //using namespace stdしないと表記がめんどくさいからね、仕方ないね using namespace std; //可読性を上げるためのdefineが仇となる典型的パターン #define rep(i,n) for(int i = 0; i < n; i++) //ローカル変数とグローバル変数は使い分けよう! short n, x, y, j, k; short planar[14][14]; int s; unsigned long long int ans; //関数って楽しいよね!(魔王スマイル) void bom(short c, short d) { planar[c][d] = 0; if (planar[c + 1][d] != 0) bom(c + 1, d); if (planar[c - 1][d] != 0) bom(c - 1, d); if (planar[c][d + 1] != 0) bom(c, d + 1); if (planar[c][d - 1] != 0) bom(c, d - 1); if (planar[c + 2][d] != 0) bom(c + 2, d); if (planar[c - 2][d] != 0) bom(c - 2, d); if (planar[c][d + 2] != 0) bom(c, d + 2); if (planar[c][d - 2] != 0) bom(c, d - 2); if (planar[c - 3][d] != 0) bom(c - 3, d); if (planar[c + 3][d] != 0) bom(c + 3, d); if (planar[c][d + 3] != 0) bom(c, d + 3); if (planar[c][d - 3] != 0) bom(c, d - 3); return; } } int main() { rep(i, 14) { planar[i][0] = 0; planar[i][1] = 0; planar[i][2] = 0; planar[i][11] = 0; planar[i][12] = 0; planar[i][13] = 0; planar[0][i] = 0; planar[1][i] = 0; planar[2][i] = 0; planar[11][i] = 0; planar[12][i] = 0; planar[13][i] = 0; } scanf("%d", &n); rep(i, n) { scanf("\n"); for (j = 3; j <= 10; j++) for (k = 3; k <= 10; k++) scanf("%1d", &planar[j][k]); scanf("%d", &x); scanf("%d", &y); bom(y + 2, x + 2); printf("Data %d:\n", i + 1); for (j = 3; j <= 10; j++) { for (k = 3; k <= 10; k++) { printf("%d", planar[j][k]); } printf("\n"); } } return 0; }
a.cc:59:1: error: expected declaration before '}' token 59 | } | ^
s026950585
p00071
C++
#include<iostream> #include<string> #include<vector> using namespace std; #define loop(i,a,b) for(int i=a;i<b;i++) void bom(int x,int y,char& in[8][8]){ in[x][y]='0'; loop(i,-3,4){ loop(j,-3,4){ if(i&&j)continue; if(x+i>=0&&x+i<8&&y+j>=0&&y+j<8&&in[x+i][y+j]=='1')bom(x+i,y+j,in); } } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ char in[8][8]; for(int j=0;j<8;j++){ cin>>in[j]; } int x,y; cin>>x>>y; if(in[y-1][x-1]=='1')bom(y-1,x-1,in); cout<<"Data "<<i<<':'<<endl; for(int i=0;i<8;i++){ loop(j,0,8) cout<<in[i][j]; cout<<endl; } } }
a.cc:6:28: error: declaration of 'in' as array of references 6 | void bom(int x,int y,char& in[8][8]){ | ^~ a.cc: In function 'void bom(...)': a.cc:7:3: error: 'in' was not declared in this scope; did you mean 'int'? 7 | in[x][y]='0'; | ^~ | int a.cc:7:6: error: 'x' was not declared in this scope 7 | in[x][y]='0'; | ^ a.cc:7:9: error: 'y' was not declared in this scope 7 | in[x][y]='0'; | ^
s736301901
p00072
C
#include<stdio.h> int main(void){ int n,m,o; int a[101][101],b[101][101],c[2],r[3]={0}; int d=0,e=0,f=0,ans=0; int x,y,z; int h,i,j; scanf("%d%d",&n,&m); for(h=0;h<m;h++){ scanf("%d,%d,%d",&x,&y,&z); a[x][y]=1; a[y][x]=1; b[x][y]=z; b[y][x]=z; } scanf("%d",&o); while(1){ e=0; for(h=0;h<n;h++){//????¢???? d=0; for(i=0;i<n;i++){ if(a[h][i]==1){ c[0]=h; c[1]=i; d++; } } if(d==1){ ans=ans+b[c[0]][c[1]]; a[c[0]][c[1]]=0; a[c[1]][c[0]]=0; e++; } } if(e==0){//????????? r[0]=0; r[1]=0; r[2]=0; for(h=0;h<n;h++){ for(i=0;i<n;i++){ if(a[h][i]==1){ if(b[h][i]=>r[2]){ r[0]=h; r[1]=i; r[2]=b[h][i]; } } } } a[r[0]][r[1]]=0; a[r[1]][r[0]]=0; } f=0; for(h=0;h<n;h++){//break for(i=0;i<n;i++){ if(a[h][i]==1){ f++; } } } if(f==0){ break; } } ans=ans/100-n+1; printf("%d\n",ans); return 0; }
main.c: In function 'main': main.c:42:36: error: expected expression before '>' token 42 | if(b[h][i]=>r[2]){ | ^
s893159162
p00072
C
#include<stdio.h> int main(void){ int n,m,o; int a[101][101],b[101][101],c[2],r[3]={0}; int d=0,e=0,f=0,ans=0; int x,y,z; int h,i,j; scanf("%d%d",&n,&m); for(h=0;h<m;h++){ scanf("%d,%d,%d",&x,&y,&z); a[x][y]=1; a[y][x]=1; b[x][y]=z; b[y][x]=z; } scanf("%d",&o); while(1){ e=0; for(h=0;h<n;h++){//????¢???? d=0; for(i=0;i<n;i++){ if(a[h][i]==1){ c[0]=h; c[1]=i; d++; } } if(d==1){ ans=ans+b[c[0]][c[1]]; a[c[0]][c[1]]=0; a[c[1]][c[0]]=0; e++; } } if(e==0){//????????? r[0]=0; r[1]=0; r[2]=0; for(h=0;h<n;h++){ for(i=0;i<n;i++){ if(a[h][i]==1){ if(b[h][i]=>r[2]){ r[0]=h; r[1]=i; r[2]=b[h][i]; } } } } a[r[0]][r[1]]=0; a[r[1]][r[0]]=0; } f=0; for(h=0;h<n;h++){//break for(i=0;i<n;i++){ if(a[h][i]==1){ f++; } } } if(f==0){ break; } } ans=ans/100-n+1; printf("%d\n",ans); return 0; }
main.c: In function 'main': main.c:42:36: error: expected expression before '>' token 42 | if(b[h][i]=>r[2]){ | ^
s220584760
p00072
C
#include<stdio.h> #define INF 1000000000 void MST(int); int edge[101][101],v[101],d[101],sum=0,n; int main(void){ int m,a,b,i,j, cost; while(1){ count=0; scanf("%d",&n); if(n==0)break; scanf("%d",&m); for(i=0;i<101;i++){ for(j=0;j<101;j++){ edge[i][j]=INF; } } for(i=0;i<m;i++){ scanf("%d,%d,%d",&a,&b,&cost); edge[a][b]=cost; edge[b][a]=cost; } for(i=0;i<101;i++){ d[i]=INF; v[i]=0; } d[0]=0; sum = 0; MST(0); printf("%d\n",sum); } return 0; } void MST(int u) { int x=0,i; while(1){ int minv=INF; for(i=0;i<n;i++){ if(v[i]==0 && d[i]<minv){ //d[i]=edge[x][i]; x=i; minv=d[i]; } } if(minv==INF)break; v[x]=1; if ( x != u ) sum+=(d[x]/100-1); for(i=0;i<n;i++){ if ( v[i] ) continue; d[i]=min(d[i],edge[x][i]); } } } int min(int x,int y) { return x < y ? x : y; }
main.c: In function 'main': main.c:12:7: error: 'count' undeclared (first use in this function) 12 | count=0; | ^~~~~ main.c:12:7: note: each undeclared identifier is reported only once for each function it appears in main.c: In function 'MST': main.c:66:12: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration] 66 | d[i]=min(d[i],edge[x][i]); | ^~~ | main
s243215038
p00072
C++
#include <iostream> #include <vector> #include <tuple> // Union Find template<class T=int> class UnionFind { std::vector<T> p; std::vector<T> r; T find(const T x) { if(x==p[x]) return x; return p[x]=find(p[x]); } void unite_(T x, T y) { if(x==y) return; if(r[x]>r[y]) std::swap(x,y); else if(r[x]==r[y]) ++r[y]; p[x]=y; } public: explicit UnionFind(const T n):p(n),r(n,0) { for(T i=0; i<n; ++i) p[i]=i; } bool same(const T x, const T y) { // assert(0<=x && x<p.size()) // assert(0<=y && y<p.size()) return find(x)==find(y); } void unite(const T x, const T y) { // assert(0<=x && x<p.size()) // assert(0<=y && y<p.size()) unite_(find(x),find(y)); } }; // Kruskal's algorithm template<class T, class U> T& kruskal(T& edges, U max_v) { typedef typename T::value_type Edge; std::sort(edges.begin(),edges.end()); UnionFind<U> uf(max_v); edges.erase( std::remove_if(edges.begin(),edges.end(), [&uf](const Edge& e){ const auto& a = std::get<1>(e); const auto& b = std::get<2>(e); if(uf.same(a,b)) return true; uf.unite(a,b); return false; }), edges.end()); return edges; } int main() { std::cin.tie(0); std::ios_base::sync_with_stdio(false); for(int n,m; (std::cin >> n >> m) && n; ) { typedef std::tuple<int,int,int> T; std::vector<T> edges(m); for(auto& v: edges) { int a,b,d; char c; std::cin >> a >> c >> b >> c >> d; v = T(d,a,b); } int c=0; for(auto& e: kruskal(edges, n)) c+=std::get<0>(e)/100-1; std::cout << c << "\n"; } }
a.cc: In function 'T& kruskal(T&, U)': a.cc:48:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 48 | std::sort(edges.begin(),edges.end()); | ^~~~ | qsort a.cc:51:14: error: 'remove_if' is not a member of 'std'; did you mean 'remove_cv'? 51 | std::remove_if(edges.begin(),edges.end(), | ^~~~~~~~~ | remove_cv
s654508209
p00072
C++
#include <iostream> #include <vector> #include <tuple> // Union Find template<class T=int> class UnionFind { std::vector<T> p; std::vector<T> r; T find(const T x) { if(x==p[x]) return x; return p[x]=find(p[x]); } void unite_(T x, T y) { if(x==y) return; if(r[x]>r[y]) std::swap(x,y); else if(r[x]==r[y]) ++r[y]; p[x]=y; } public: explicit UnionFind(const T n):p(n),r(n,0) { for(T i=0; i<n; ++i) p[i]=i; } bool same(const T x, const T y) { // assert(0<=x && x<p.size()) // assert(0<=y && y<p.size()) return find(x)==find(y); } void unite(const T x, const T y) { // assert(0<=x && x<p.size()) // assert(0<=y && y<p.size()) unite_(find(x),find(y)); } }; // Kruskal's algorithm template<class T, class U> T& kruskal(T& edges, U max_v) { typedef typename T::value_type Edge; std::sort(edges.begin(),edges.end()); UnionFind<U> uf(max_v); edges.erase( std::remove_if(edges.begin(),edges.end(), [&uf](const Edge& e){ const auto& a = std::get<1>(e); const auto& b = std::get<2>(e); if(uf.same(a,b)) return true; uf.unite(a,b); return false; }), edges.end()); return edges; } int main() { std::cin.tie(0); std::ios_base::sync_with_stdio(false); for(int n,m; (std::cin >> n >> m) && n; ) { typedef std::tuple<int,int,int> T; std::vector<T> edges(m); for(auto& v: edges) { int a,b,d; char c; std::cin >> a >> c >> b >> c >> d; v = T(d,a,b); } int c=0; for(auto& e: kruskal(edges, n)) c+=std::get<0>(e)/100-1; std::cout << c << "\n"; } }
a.cc: In function 'T& kruskal(T&, U)': a.cc:48:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 48 | std::sort(edges.begin(),edges.end()); | ^~~~ | qsort a.cc:51:14: error: 'remove_if' is not a member of 'std'; did you mean 'remove_cv'? 51 | std::remove_if(edges.begin(),edges.end(), | ^~~~~~~~~ | remove_cv
s628960094
p00072
C++
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; class UF{ vi p,r; public: UF(int n):p(n,-1),r(n,0){ } int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); } void unite(int x,int y){ x = find(x); y = find(y); if(x==y)return; if(r[x] < r[y])p[x] = y; else p[y] = x; if(r[x] == r[y])r[x]++; } bool same(int x,int y){return find(x)==find(y);} }; const int INF= 1e9; struct edge{ int from, to, cost; edge(int x,int y, int z):from(x),to(y),cost(z){} bool operator<(const edge &x)const{ return cost<x.cost; } }; class Kruskal{ int n; vector< vector<edge> > g; public: Kruskal(int a=0):n(a){ g.resize(n); } void AddEdge(int a, int b, int cost){ g[a].push_back(edge(a,b,cost)); g[b].push_back(edge(b,a,cost)); } int MinSpanningTree(){ UF connect(n); vector<edge> edges; for(int v=0;v<n;v++){ for(edge e.: g[v])edges.push_back(e); } sort(edges.begin(), edges.end()); int res = 0; for(edge e : edges){ if(!connect.same(e.from,e.to)){ res += e.cost; connect.unite(e.from,e.to); } } return res; } }; int main(){ int n,m; while(scanf("%d",&n),n){ Kruskal p(n); cin >> m; for(int i=0;i<m;i++){ int a,b,c; scanf("%d,%d,%d",&a,&b,&c); p.AddEdge(a,b,c/100-1); } cout << p.MinSpanningTree() << endl; } }
a.cc: In member function 'int Kruskal::MinSpanningTree()': a.cc:48:17: error: expected ';' before '.' token 48 | for(edge e.: g[v])edges.push_back(e); | ^ a.cc:48:17: error: expected primary-expression before '.' token a.cc:48:18: error: expected unqualified-id before ':' token 48 | for(edge e.: g[v])edges.push_back(e); | ^ a.cc:48:18: error: expected ';' before ':' token a.cc:48:18: error: expected primary-expression before ':' token a.cc:48:18: error: expected ')' before ':' token a.cc:48:10: note: to match this '(' 48 | for(edge e.: g[v])edges.push_back(e); | ^ a.cc:48:18: error: expected primary-expression before ':' token 48 | for(edge e.: g[v])edges.push_back(e); | ^
s269497161
p00072
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define pb push_back struct EDGE { int to, cost; bool operator < (const EDGE& t) const { return cost > t.cost; } }; vector<EDGE> v[100]; bool f[100]; int search() { int res = 0; prioritiy_queue<EDGE> que; que.push({0, 0}); while (!que.empty()){ EDGE e = que.top(); que.pop(); if (f[e.to]) continue; f[e.to] = true; res += e.cost; rep(i, v[e.to].size()){ if (!f[v[e.to][i].to]){ que.push(v[e.to][i]); } } } return res; } int main() { int n, m; while (scanf("%d", &n), n){ scanf("%d", &m); rep(i,m){ int a, b, c; scanf("%d%d%d",&a,&b,&c); a--; b--; c = c / 100 - 1; v[a].pb({b, c}); v[b].pb({a, c}); } printf("%d", search()); memset(f, false, sizeof(f)); rep(i, n) v[i].clear(); } return 0; }
a.cc: In function 'int search()': a.cc:17:5: error: 'prioritiy_queue' was not declared in this scope 17 | prioritiy_queue<EDGE> que; | ^~~~~~~~~~~~~~~ a.cc:17:25: error: expected primary-expression before '>' token 17 | prioritiy_queue<EDGE> que; | ^ a.cc:17:27: error: 'que' was not declared in this scope 17 | prioritiy_queue<EDGE> que; | ^~~
s489104168
p00072
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; struct Edge{ int from, to, cost; }; bool comp(const Edge& e1, const Edge& e2){ return e1.cost < e2.cost; } const int N = 1 << 30; vector<Edge> e; int par[N]; int rank_[N]; int find(int x) { if(x == par[x]) return x; else return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if(x == y) return; if(rank_[x] < rank_[y]) par[x] = y; else { par[y] = x; if(rank_[x] == rank_[y]) rank_[x]++; } } bool same(int x, int y) { return find(x) == find(y); } int main() { cin.tie(0); ios::sync_with_stdio(false); while(1){ int n, m; cin >> n; if(n == 0) break; cin >> m; int a1, a2, a3; char b1, b2; for(int i = 0; i != m; ++i){ cin >> a1 >> b1 >> a2 >> b2 >> a3; e.push_back(Edge{a1, a2, a3 / 100}); } for(int i = 0; i != n; ++i){ par[i] = i; rank_[i] = 0; } sort(e.begin(), e.end(), comp); int ans = 0; for(int i = 0; i != n; ++i){ if(!same(e[i].from, e[i].to)){ unite(e[i].from, e[i].to); ans += e[i].cost; } } cout << ans - n + 1 << endl; } return 0; }
/tmp/cciZKGCn.o: in function `unite(int, int)': a.cc:(.text+0xe0): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o a.cc:(.text+0xf7): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o a.cc:(.text+0x14b): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o a.cc:(.text+0x17d): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o a.cc:(.text+0x197): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o /tmp/cciZKGCn.o: in function `main': a.cc:(.text+0x324): relocation truncated to fit: R_X86_64_PC32 against symbol `rank_' defined in .bss section in /tmp/cciZKGCn.o collect2: error: ld returned 1 exit status
s125262512
p00072
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; struct Edge{ int from, to, cost; }; bool comp(const Edge& e1, const Edge& e2){ return e1.cost < e2.cost; } const int N = 10000; vector<Edge> e; int par[N]; int rank[N]; int find(int x) { if(x == par[x]) return x; else return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if(x == y) return; if(rank[x] < rank[y]) par[x] = y; else { par[y] = x; if(rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y) { return find(x) == find(y); } int main() { cin.tie(0); ios::sync_with_stdio(false); while(1){ int n, m; cin >> n; if(n == 0) break; cin >> m; int a1, a2, a3; char b1, b2; for(int i = 0; i != m; ++i){ cin >> a1 >> b1 >> a2 >> b2 >> a3; e.push_back(Edge{a1, a2, a3 / 100 - 1}); } for(int i = 0; i != n; ++i){ par[i] = i; rank[i] = 0; } sort(e.begin(), e.end(), comp); int ans = 0; for(int i = 0; i != m; ++i){ if(!same(e[i].from, e[i].to)){ unite(e[i].from, e[i].to); ans += e[i].cost; } } cout << ans << endl; } return 0; }
a.cc: In function 'void unite(int, int)': a.cc:33:12: error: reference to 'rank' is ambiguous 33 | if(rank[x] < rank[y]) | ^~~~ In file included from /usr/include/c++/14/bits/move.h:37, from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:16:5: note: 'int rank [10000]' 16 | int rank[N]; | ^~~~ a.cc:33:22: error: reference to 'rank' is ambiguous 33 | if(rank[x] < rank[y]) | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:16:5: note: 'int rank [10000]' 16 | int rank[N]; | ^~~~ a.cc:37:20: error: reference to 'rank' is ambiguous 37 | if(rank[x] == rank[y]) | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:16:5: note: 'int rank [10000]' 16 | int rank[N]; | ^~~~ a.cc:37:31: error: reference to 'rank' is ambiguous 37 | if(rank[x] == rank[y]) | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:16:5: note: 'int rank [10000]' 16 | int rank[N]; | ^~~~ a.cc:38:25: error: reference to 'rank' is ambiguous 38 | rank[x]++; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:16:5: note: 'int rank [10000]' 16 | int rank[N]; | ^~~~ a.cc: In function 'int main()': a.cc:68:25: error: reference to 'rank' is ambiguous 68 | rank[i] = 0; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:16:5: note: 'int rank [10000]' 16 | int rank[N]; | ^~~~
s464306870
p00072
C++
#include<iostream> #include<cstdio> #include<queue> #include<vector> using namespace std; typedef pair<int, int> P; int N, M; vector<P> g[100]; bool done[100]; int main() { while(true) { fill(done, done + 100, 0); for(int i = 0; i < 100; i++) g[i].reset(); cin >> N; if(!N) break; cin >> M; for(int i = 0; i < M; i++) { int a, b, c; scanf("%d,%d,%d", &a, &b, &c); printf("%d %d %d \n", a, b, c); c = c / 100 - 1; g[a].push_back(make_pair(c, b)); g[b].push_back(make_pair(c, a)); } priority_queue<P, vector<P>, greater<P>> q; q.push(make_pair(0, 0)); int cost = 0; while(q.size()) { auto p = q.top(); q.pop(); if(done[p.second]) continue; done[p.second] = true; cost += p.first; for(auto e: g[p.second]) { if(done[e.second]) continue; q.push(e); } } cout << cost << endl; } }
a.cc: In function 'int main()': a.cc:18:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'reset' 18 | g[i].reset(); | ^~~~~
s529362938
p00072
C++
int mincost[MAX_V]; //集合Xからの最小コスト bool used[MAX_V]; //頂点iがxに含まれているか int m; //頂点数 using namespace std; int main(){ int n,i,c,j,a,b; while(1){ scanf("%d",&n); if(n==0) break; scanf("%d",&m); for(j=0;j<m;j++){ for(i=0;i<m;++i){ cost[j][i]=INF; } } for(i=0;i<m;i++){ scanf("%d,%d",&a,&b); scanf(",%d",&c); cost[a][b]=c/100-1; cost[b][a]=c/100-1; } printf("%d\n",prim()); } return 0; } int prim(){ //初期化 for(int i=0;i<m;++i){ mincost[i]=INF; used[i]=false; } mincost[0]=0; int res=0; while(true){ int v=-1; //xに属さない頂点のうちxからの辺のコストが最小になる頂点を探す for(int u=0;u<m;u++){ if(!used[u]&&(v==-1||mincost[u]<mincost[v])) v=u; } if(v==-1) break; used[v]=true; //頂点vをxに追加 res+=mincost[v]; //辺のコストを比べる for(int u=0;u<m;u++){ mincost[u]=min(mincost[u],cost[v][u]); } } return res; }
a.cc:1:13: error: 'MAX_V' was not declared in this scope 1 | int mincost[MAX_V]; //集合Xからの最小コスト | ^~~~~ a.cc:2:11: error: 'MAX_V' was not declared in this scope 2 | bool used[MAX_V]; //頂点iがxに含まれているか | ^~~~~ a.cc: In function 'int main()': a.cc:11:5: error: 'scanf' was not declared in this scope 11 | scanf("%d",&n); if(n==0) break; | ^~~~~ a.cc:15:9: error: 'cost' was not declared in this scope; did you mean 'const'? 15 | cost[j][i]=INF; | ^~~~ | const a.cc:15:20: error: 'INF' was not declared in this scope 15 | cost[j][i]=INF; | ^~~ a.cc:20:7: error: 'cost' was not declared in this scope; did you mean 'const'? 20 | cost[a][b]=c/100-1; | ^~~~ | const a.cc:23:19: error: 'prim' was not declared in this scope 23 | printf("%d\n",prim()); | ^~~~ a.cc:23:5: error: 'printf' was not declared in this scope 23 | printf("%d\n",prim()); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int mincost[MAX_V]; //集合Xからの最小コスト a.cc: In function 'int prim()': a.cc:33:5: error: 'mincost' was not declared in this scope 33 | mincost[i]=INF; | ^~~~~~~ a.cc:33:16: error: 'INF' was not declared in this scope 33 | mincost[i]=INF; | ^~~ a.cc:34:5: error: 'used' was not declared in this scope 34 | used[i]=false; | ^~~~ a.cc:37:3: error: 'mincost' was not declared in this scope 37 | mincost[0]=0; | ^~~~~~~ a.cc:44:11: error: 'used' was not declared in this scope 44 | if(!used[u]&&(v==-1||mincost[u]<mincost[v])) v=u; | ^~~~ a.cc:48:5: error: 'used' was not declared in this scope 48 | used[v]=true; //頂点vをxに追加 | ^~~~ a.cc:52:33: error: 'cost' was not declared in this scope; did you mean 'const'? 52 | mincost[u]=min(mincost[u],cost[v][u]); | ^~~~ | const a.cc:52:18: error: 'min' was not declared in this scope; did you mean 'main'? 52 | mincost[u]=min(mincost[u],cost[v][u]); | ^~~ | main
s183637633
p00072
C++
#include <queue> #include <vector> #include <iostream> #include <algorithm> using namespace std; long long prim(int V, vector<pair<long long, long long>> X[]) { for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); while (!Q.empty()) { pair<long long, long long>pa = Q.top(); Q.pop(); long long a1 = pa.first, a2 = pa.second; color[a2] = BLACK; for (int i = 0; i < X[a2].size(); i++) { long long to = X[a2][i].first, leng = X[a2][i].second; if (dist[to] > leng && color[to] < BLACK) { dist[to] = leng; Q.push(make_pair(dist[to], to)); } } } long long sum = 0; for (int i = 0; i < V; i++) { sum += dist[i]; }//0-indexed return sum; } int n, m, u, v, w; vector<pair<long long, long long> > g[100]; int main() { while(cin >> n >> m) { for(int i = 0; i < n; i++) g[i].clear(); for(int i = 0; i < m; i++) { scanf("%d,%d,%d", u, v, w); g[u].push_back(make_pair(v, w / 100 - 1)); g[v].push_back(make_pair(u, w / 100 - 1)); } cout << prim(n, g) << endl; } }
a.cc: In function 'long long int prim(int, std::vector<std::pair<long long int, long long int> >*)': a.cc:7:39: error: 'dist' was not declared in this scope 7 | for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } | ^~~~ a.cc:7:49: error: 'INF' was not declared in this scope 7 | for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } | ^~~ a.cc:7:54: error: 'color' was not declared in this scope; did you mean 'tolower'? 7 | for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } | ^~~~~ | tolower a.cc:7:65: error: 'WHITE' was not declared in this scope 7 | for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } | ^~~~~ a.cc:8:9: error: 'dist' was not declared in this scope 8 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^~~~ a.cc:8:22: error: 'color' was not declared in this scope; did you mean 'tolower'? 8 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^~~~~ | tolower a.cc:8:33: error: 'GRAY' was not declared in this scope 8 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^~~~ a.cc:8:39: error: 'Q' was not declared in this scope 8 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^ a.cc:11:70: error: 'BLACK' was not declared in this scope 11 | long long a1 = pa.first, a2 = pa.second; color[a2] = BLACK; | ^~~~~
s735781018
p00072
C++
#include <queue> #include <vector> #include <iostream> #include <algorithm> #define WHITE 0 #define GRAY 1 #define BLACK 2 #define INF 1000000000000000000LL using namespace std; long long prim(int V, vector<pair<long long, long long>> X[]) { for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); while (!Q.empty()) { pair<long long, long long>pa = Q.top(); Q.pop(); long long a1 = pa.first, a2 = pa.second; color[a2] = BLACK; for (int i = 0; i < X[a2].size(); i++) { long long to = X[a2][i].first, leng = X[a2][i].second; if (dist[to] > leng && color[to] < BLACK) { dist[to] = leng; Q.push(make_pair(dist[to], to)); } } } long long sum = 0; for (int i = 0; i < V; i++) { sum += dist[i]; }//0-indexed return sum; } int n, m, u, v, w; vector<pair<long long, long long> > g[100]; int main() { while(cin >> n >> m) { for(int i = 0; i < n; i++) g[i].clear(); for(int i = 0; i < m; i++) { scanf("%d,%d,%d", u, v, w); g[u].push_back(make_pair(v, w / 100 - 1)); g[v].push_back(make_pair(u, w / 100 - 1)); } cout << prim(n, g) << endl; } }
a.cc: In function 'long long int prim(int, std::vector<std::pair<long long int, long long int> >*)': a.cc:11:39: error: 'dist' was not declared in this scope 11 | for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } | ^~~~ a.cc:11:54: error: 'color' was not declared in this scope; did you mean 'tolower'? 11 | for (int i = 0; i < V; i++) { dist[i] = INF; color[i] = WHITE; } | ^~~~~ | tolower a.cc:12:9: error: 'dist' was not declared in this scope 12 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^~~~ a.cc:12:22: error: 'color' was not declared in this scope; did you mean 'tolower'? 12 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^~~~~ | tolower a.cc:12:39: error: 'Q' was not declared in this scope 12 | dist[0] = 0; color[0] = GRAY; Q.push(make_pair(0, 0)); | ^