submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s879178562
p00207
C++
#include<stdio.h> #include<windows.h> int main(void) { int w,h; int map[101][101]; int st[2],go[2]; int i,j,k,l,m; int num; int b_c,b_ang,b_x,b_y; int sign; int ans; int maps=0; for(;;) { ans=0; for(i=0;i<100;i++) { for(j=0;j<100;j++) map[i][j]=0; } scanf("%d%d",&w,&h); if(w==0 && h==0) break; scanf("%d%d%d%d",&st[0],&st[1],&go[0],&go[1]); scanf("%d",&num); for(i=0;i<num;i++) { scanf("%d%d%d%d",&b_c,&b_ang,&b_x,&b_y); if(b_ang==0) { for(j=0;j<4;j++) { for(k=0;k<2;k++) map[b_x+j][b_y+k]=b_c; } } else { for(j=0;j<4;j++) { for(k=0;k<2;k++) map[b_x+k][b_y+j]=b_c; } } } if(map[st[0]][st[1]]==0 || map[go[0]][go[1]]==0) printf("NG"); else { sign=map[st[0]][st[1]]; for(i=0;i<w;i++) { for(j=0;j<h;j++) { if(map[i][j]!=sign) map[i][j]=0; else maps++; } } map[st[0]][st[1]]=-1; map[go[0]][go[1]]=-2; for(i=st[0],j=st[1];;) { /* for(m=0;m<h;m++) { for(l=0;l<w;l++) { printf("%d ",map[l][m]); } printf("%dツ行\n",l); } getchar(); system("cls"); */ if(map[i+1][j]==-2 || map[i][j+1]==-2 || map[i-1][j]==-2 || map[i][j-1]==-2) { ans=1; break; } else if(map[i-1][j]!=0 && map[i][j-1]!=0 && map[i+1][j]!=0 && map[i][j+1]!=0) { if(map[i+1][j]==sign) { map[i][j]=7; i++; maps--; } else if(map[i][j+1]==sign) { map[i][j]=7; j++; maps--; } else if(map[i-1][j]==sign) { map[i][j]=7; i--; maps--; } else if(map[i][j-1]==sign) { map[i][j]=7; j--; maps--; } } else if(map[i+1][j]==sign/* && map[i][j-1]!=sign*/)//ツ右 { // printf("migi\n"); map[i][j]=7; i++; maps--; } else if(/*map[i+1][j]!=sign && */map[i][j+1]==sign)//ツ可コ { // printf("sita1\n"); map[i][j]=7; j++; maps--; } else if(map[i-1][j]==sign/* && map[i][j+1]!=sign*/)//ツ債カ { // printf("hidari\n"); map[i][j]=7; i--; maps--; } else if(/*map[i+1][j]!=sign && */map[i][j-1]==sign)//ツ湘」 { // printf("ue1\n"); map[i][j]=7; j--; maps--; } else if(/*map[i-1][j]!=sign && */map[i][j+1]==sign)//ツ可コ { // printf("sita2\n"); map[i][j]=7; j++; maps--; } else if(map[i-1][j]!=sign && map[i][j-1]==sign)//ツ湘」 { // printf("ue2\n"); map[i][j]=7; maps--; j--; } else if(map[i+1][j]!=sign && map[i][j+1]!=sign && map[i-1][j]!=sign && map[i][j-1]!=sign && maps==0) { ans=2; break; } else { map[i][j]=7; for(m=0;m<h;m++) { for(l=0;l<w;l++) { if((map[m][l]==sign && map[m][l+1]==7) || (map[m][l]==sign && map[m-1][l])) { i=m; j=l; } } } } } if(ans==1) printf("OK"); else if(ans==2) printf("NG"); } } } /* 20 20 1 1 2 7 7 2 0 1 1 5 1 1 3 2 1 3 3 1 1 5 2 5 1 7 3 2 0 2 7 2 0 6 8 */
a.cc:2:9: fatal error: windows.h: No such file or directory 2 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.
s815595266
p00207
C++
#include<iostream> bool flag; int n,sx,sy,gx,gy,col; void erase(int** field){ for(int i=0; i<102; i++) for(int j=0; j<102; j++) field[i][j] = 0; } void DFS(int x, int y, int** field){ int xx = x+1; int yy = y; if(xx == gx && yy == gy){ flag = true; return; } if(field[yy][xx] == col) DFS(xx, yy, field); if(flag) return; xx = x; yy = y+1; if(field[yy][xx] == col) DFS(xx, yy, field); if(flag) return; xx = x-1; yy = y; if(field[yy][xx] == col) DFS(xx, yy, field); if(flag) return; xx = x; yy = y-1; if(field[yy][xx] == col) DFS(xx, yy, field); } int main(){ int field[102][102];//y,x int c,d,bx,by; using std::cin; while(true){ flag = false; erase(field); cin >> c >> d; if(!c && !d) return 0; cin >> sx >> sy; cin >> gx >> gy; cin >> n; for(int i=0; i<n; i++){ cin >> c >> d >> bx >> by; if(d==0){ for(int h=by; h<by+2; h++) for(int k=bx; k<bx+4; k++) field[h][k] = c; } else{ for(int h=by; h<by+4; h++) for(int k=bx; k<bx+2; k++) field[h][k] = c; } } col = field[gy][gx]; DFS(sx, sy, field); if(flag) std::cout << "OK\n"; else std::cout << "NG\n"; } }
a.cc: In function 'int main()': a.cc:52:23: error: cannot convert 'int (*)[102]' to 'int**' 52 | erase(field); | ^~~~~ | | | int (*)[102] a.cc:6:18: note: initializing argument 1 of 'void erase(int**)' 6 | void erase(int** field){ | ~~~~~~^~~~~ a.cc:73:29: error: cannot convert 'int (*)[102]' to 'int**' 73 | DFS(sx, sy, field); | ^~~~~ | | | int (*)[102] a.cc:12:30: note: initializing argument 3 of 'void DFS(int, int, int**)' 12 | void DFS(int x, int y, int** field){ | ~~~~~~^~~~~
s061382726
p00207
C++
#include<iostream> int field[102][102];//y,x bool flag; int sx,sy,gx,gy,col; void erase(){ for(int i=0; i<102; i++) for(int j=0; j<102; j++) field[i][j] = 0; } void DFS(int x, int y){ if(sx < gy) DFSr(x,y); else DFSl(x,y); } void DFSr(int x, int y){ if(field[y][x] != col) return; if(x == gx && y == gy){ flag = true; return; } DFSr(x+1, y); if(flag) return; DFSr(x, y+1); if(flag) return; DFSr(x, y-1); if(flag) return; DFSr(x-1, y); } void DFSl(int x, int y){ if(field[y][x] != col) return; if(x == gx && y == gy){ flag = true; return; } DFSl(x-1, y); if(flag) return; DFSl(x, y+1); if(flag) return; DFSl(x, y-1); if(flag) return; DFSl(x+1, y); } int main(){ int n,c,d,bx,by; while(true){ flag = false; erase(); std::cin >> c >> d; if(!c && !d) return 0; std::cin >> sx >> sy; std::cin >> gx >> gy; std::cin >> n; for(int i=0; i<n; i++){ std::cin >> c >> d >> bx >> by; if(d==0) for(int h=by; h<by+2; h++) for(int w=bx; w<bx+4; w++) field[h][w] = c; else for(int h=by; h<by+4; h++) for(int w=bx; w<bx+2; w++) field[h][w] = c; } col = field[gy][gx]; DFS(sx, sy); if(flag) std::cout << "OK\n"; else std::cout << "NG\n"; } }
a.cc: In function 'void DFS(int, int)': a.cc:15:17: error: 'DFSr' was not declared in this scope; did you mean 'DFS'? 15 | DFSr(x,y); | ^~~~ | DFS a.cc:17:17: error: 'DFSl' was not declared in this scope; did you mean 'DFS'? 17 | DFSl(x,y); | ^~~~ | DFS
s230321144
p00207
C++
#include <iostream> int m[101][101]; int w,h,r,gx,gy; void dfs(int x,int y,int c){ if(!(x-gx)&&!(y-gy))r=1; if(x>0&&m[x-1][y]==c)m[x-1][y]=0,dfs(x-1,y,c); if(x<w&&m[x+1][y]==c)m[x+1][y]=0,dfs(x+1,y,c); if(y>0&&m[x][y-1]==c)m[x][y-1]=0,dfs(x,y-1,c); if(y<h&&m[x][y+1]==c)m[x][y+1]=0,dfs(x,y+1,c); return ; } int main(){ //wh‚̓{[ƒh‚̑傫‚³An‚̓uƒƒbƒN‚̌” int n,c,d,sx,sy,bx,by; //sp‚̓Xƒ^[ƒg’n“_‚̍À•WAgp‚̓S[ƒ‹’n“_‚̍À•W point sp,bp; while(std::cin>>w>>h,w&&h){ for(int y=0;y<101;y++){ for(int x=0;x<101;x++){ m[x][y] = 0; } } r=0; std::cin>>sx>>sy; std::cin>>gx>>gy; std::cin>>n; for(int i=0;i<n;i++){ std::cin>>c>>d>>bx>>by; int bw,bh; d?bw=2,bh=4:bh=2,bw=4; for(int y=by;y<=by+bh;y++){ for(int x=bx;x<=bx+bw;x++){ m[x][y] = c; } } } if(m[sx][sy])dfs(sx,sy,m[sx][sy]),m[sx][sy] = 0; if(r)std::cout<<"OK"<<std::endl; else{std::cout<<"NG"<<std::endl;} } return 0; }
a.cc: In function 'int main()': a.cc:17:9: error: 'point' was not declared in this scope 17 | point sp,bp; | ^~~~~
s597416870
p00207
C++
#include<stdio.h> #include<string.h> int gx,gy,m[128][128]; int F(int x,int y,int c) { if(x==gx&&y==gy) return 1; if(m[y][x]!=c) return 0; m[y][x]=-c; int d[]={0,1,0,-1,0},i,f; for(i=f=0;i<4;++i) f=f||F(x+d[i],y+d[i+1],c); return f; } int main() { int w,h,sx,sy,x,y,n,c,d,i,j; while(scanf("%d%d",&w,&h),w) { memset(m,0,sizeof(m)); scanf("%d%d%d%d%d",&sx,&sy,&gx,&gy,&n); while(n--) { scanf("%d%d%d%d",&c,&d,&x,&y); for(i=0;i<2;++i)for(j=0;j<4;++j) if(d) m[y+j][x+i]=c; else m[y+i][x+j]=c; }j<=w;++j)printf("%c",".@#$%*"[m[i][j]]); if(1<=sx&&sx<=w&&1<=sy&&sy<=h&&m[sy][sx]&&F(sx,sy,m[sy][sx]))puts("YES"); else puts("NO"); } return 0; }
a.cc: In function 'int main()': a.cc:29:26: error: expected ';' before ')' token 29 | }j<=w;++j)printf("%c",".@#$%*"[m[i][j]]); | ^ | ;
s143901893
p00207
C++
#include<cfloat> #include<cstring> #define foreach(t,p,it) for(t::iterator it=p.begin(),it!=p.end(),++it) #define all(p) p.begin(),p.end() #define rep(i,n) for(int i=0;i<n;i++) #define REP(n) rep(i,n) using namespace std; const int W=210,H = 210; int block[W][H]; int ans; int w,h,xs,ys,xg,yg,n,c,d,x,y; void solve(int xi,int yi) { if(ans == 1) return ; //cout << xi <<" " << yi << endl; if(xi==xg && yi==yg){ ans = 1; return;} if(block[xi][yi] == c) { block[xi][yi] = 0; solve(xi-1,yi); solve(xi,yi-1); solve(xi+1,yi); solve(xi,yi+1); } else return; } int main() { while(cin >> w >> h ) { if(w==0 && h==0) break; memset(block,0,sizeof(block)); ans = 0; cin >> xs >> ys; cin >> xg >> yg; cin >> n; REP(n) { cin >> c >> d >> x >> y; //cout << x << ","<< y << endl; if(d==1) //tate { block[x][y] = c; block[x][y+1] =c; block[x][y+2] = c; block[x][y+3] = c; block[x+1][y] = c; block[x+1][y+1] = c; block[x+1][y+2] = c; block[x+1][y+3] = c; } else { block[x][y] = c; block[x+1][y] = c; block[x+2][y] = c; block[x+3][y] = c; block[x][y+1] = c; block[x+1][y+1] = c; block[x+2][y+1] = c; block[x+3][y+1] = c; } } c = block[xs][ys]; if(c==0) {cout <<"NG" << endl; continue;} //cout << xs << " " << ys << " " << c << endl; //cout <<"input " << endl; solve(xs,ys); if(ans) cout << "OK" << endl; else cout << "NG" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:32:11: error: 'cin' was not declared in this scope 32 | while(cin >> w >> h ) | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<cstring> +++ |+#include <iostream> 3 | #define foreach(t,p,it) for(t::iterator it=p.begin(),it!=p.end(),++it) a.cc:68:19: error: 'cout' was not declared in this scope 68 | if(c==0) {cout <<"NG" << endl; continue;} | ^~~~ a.cc:68:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:68:34: error: 'endl' was not declared in this scope 68 | if(c==0) {cout <<"NG" << endl; continue;} | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<cstring> +++ |+#include <ostream> 3 | #define foreach(t,p,it) for(t::iterator it=p.begin(),it!=p.end(),++it) a.cc:74:17: error: 'cout' was not declared in this scope 74 | if(ans) cout << "OK" << endl; | ^~~~ a.cc:74:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:74:33: error: 'endl' was not declared in this scope 74 | if(ans) cout << "OK" << endl; | ^~~~ a.cc:74:33: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:75:14: error: 'cout' was not declared in this scope 75 | else cout << "NG" << endl; | ^~~~ a.cc:75:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:75:30: error: 'endl' was not declared in this scope 75 | else cout << "NG" << endl; | ^~~~ a.cc:75:30: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s079509017
p00207
C++
#include<iostream> #include<vector> using namespace std; void PutBlock(vector< vector<int> >&, int, int, int, int); void CheckMaze1(vector< vector<int> >&, int&, int, int, int, int, int); void CheckMaze2(vector< vector<int> >&, int&, int, int, int, int, int); int main(){ int k, i, j, w, h, n, xs, ys, xg, yg, c, d, x, y, color, ans; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; vector<int> _data(w, 0); vector< vector<int> > data(h, w); cin >> ys >> xs; cin >> yg >> xg; --xs; --xg; --ys; --yg; cin >> n; for(i=0; i<n; ++i){ cin >> c >> d >> y >> x; PutBlock(data, c, d, x-1, y-1); } color = data[xs][ys]; ans = 0; CheckMaze1(data, ans, color, xs, ys, xg, yg); if(ans == 1) cout << "OK" << endl; else cout << "NG" << endl; } return 0; } void PutBlock(vector< vector<int> >& data, int c, int d, int x, int y){ int i, j; if(d == 0){ for(i=x; i<x+2; ++i){ for(j=y; j<y+4; ++j) data[i][j] = c; } }else{ for(i=x; i<x+4; ++i){ for(j=y; j<y+2; ++j) data[i][j] = c; } } } void CheckMaze1(vector< vector<int> >& data, int& ans, int color, int x, int y, int xg, int yg){ data[x][y] = -1; if(x == xg && y == yg) ans = 1; CheckMaze2(data, ans, color, x-1, y, xg, yg); CheckMaze2(data, ans, color, x, y-1, xg, yg); CheckMaze2(data, ans, color, x+1, y, xg, yg); CheckMaze2(data, ans, color, x, y+1, xg, yg); } void CheckMaze2(vector< vector<int> >& data, int& ans, int color, int x, int y, int xg, int yg){ if(x > -1 && x < data.size() && y > -1 && y < data[0].size() && data[x][y] == color) CheckMaze1(data, ans, color, x, y, xg, yg); }
a.cc: In function 'int main()': a.cc:18:36: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int&)' 18 | vector< vector<int> > data(h, w); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /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_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_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
s351182782
p00207
C++
#include <iostream> #include <queue> using namespace std; #define rep(i,n) for(int i = 0; i < n; i++) #define MAX 50 int dx[] = {0,0,-1,1}, dy[] = {1,-1,0,0}; typedef pair<int,int> P; P S,G; int w,h; int maze[MAX][MAX]; int color; bool check() { queue<P> que; que.push(S); color = maze[S.second][S.first]; int nx,ny; while(que.size()){ P p = que.front(); que.pop(); if(p == G) return true; rep(i,4){ nx = p.first + dx[i], ny = p.second + dy[i]; if(nx > -1 && ny > -1 && nx < w && ny < h && maze[ny][nx] == color){ maze[ny][nx] = -1; que.push(P(nx,ny)); } } } return false; } int main(void) { int n,c,d,x,y; while(cin >> w >> h, w){ cin >> S.first >> S.second; cin >> G.first >> G.second; S.first = S.first / 2; S.second= S.second/ 2; cin >> n; rep(i,n){ cin >> c >> d >> x >> y; x /= 2; y /= 2; x++; y++; if(d == 0) maze[y][x] = maze[y][x+1] = c; else maze[y][x] = maze[y+1][x] = c; } if(check()) printf("OK\n"); else printf("NG\n"); /* rep(i,y){ rep(j,x) printf("%2d", maze[i][j]); cout << endl; } } */ return 0; }
a.cc: In function 'int main()': a.cc:86:2: error: expected '}' at end of input 86 | } | ^ a.cc:49:1: note: to match this '{' 49 | { | ^
s555099599
p00207
C++
#include <iostream> #include <queue> using namespace std; #define rep(i,n) for(short i = 0; i < n; i++) #define MAX 50 int dx[] = {0,0,-1,1}, dy[] = {1,-1,0,0}; typedef pair<short,short> P; P S,G; short w,h; short color; queue<P> que; que.push(S); bool check(short maze[MAX][MAX]) { color = maze[S.second][S.first]; short nx,ny; while(que.size()){ P p = que.front(); que.pop(); if(p == G){ while(que.size()) que.pop(); return true; } rep(i,4){ nx = p.first + dx[i], ny = p.second + dy[i]; if(nx > -1 && ny > -1 && nx < w && ny < h && maze[ny][nx] == color){ maze[ny][nx] = -1; que.push(P(nx,ny)); } } } return false; } int main(void) { short n,c,d,x,y; short maze[MAX][MAX]; while(cin >> w >> h, w){ cin >> S.first >> S.second; cin >> G.first >> G.second; S.first = S.first / 2; S.second= S.second/ 2; cin >> n; rep(i,n){ cin >> c >> d >> x >> y; x /= 2; y /= 2; x++; y++; if(d == 0) maze[y][x] = maze[y][x+1] = c; else maze[y][x] = maze[y+1][x] = c; } if(maze[S.second][S.first] == maze[G.second][G.first] && check(maze)) cout << "OK\n"; else cout << "NG\n"; } return 0; }
a.cc:18:9: error: 'que' does not name a type 18 | que.push(S); | ^~~
s355757095
p00207
C++
#include<iostream> #include<string> #include<string.h> #include<cstring> #include<cmath> #include<algorithm> #include<stdlib.h> #include<queue> #include<map> #include<vector> #include<list> #include<stack> #include<functional> using namespace std; #define all(c) (c).begin(), (c).end() #define rep(i,n) for(int i=0;i<n;i++) typedef unsigned long long ull; typedef long long ll; const int INF=100000000; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0-1}; typedef pair<int ,int > P; char maze[105][105]; int sx,sy; int gx,gy; int w,h; char sc; //スタート地点のカラー //stdin //stdout void dfs(int x,int y) { maze[x][y]='9'; for(int i=-1;i<=1;i++) { for(int j=-1;j<=1;j++) { int nx=x+i; int ny=y+j; if(0<=nx && nx<=w && 0<=ny && ny<=h &&maze[nx][ny] != '0'&&maze[nx][ny] != '9') { dfs(nx,ny); } } } return ; } void solve() { rep(i,101) rep(j,101) maze[i][j]='0'; int n; char c; int d; int x,y; cin>>sy>>sx; cin>>gy>>gx; cin>>n; rep(i,n) { cin>>c>>d>>y>>x; if(d==1) { rep(i,4) { rep(j,2) { maze[x+i][y+j]=c; } } } else if (d==0) { rep(i,2) { rep(j,4) { maze[x+i][y+j]=c; } } } } //6 6 //1 1 //3 6 //2 //1 0 1 1 //1 1 3 3 // rep(i,w+1) // { // rep(j,h+1) // { // cout<<maze[i][j]; //// } // cout<<endl; // } //// cout<<maze[gx][gy]<<endl; if(maze[sx][sy]=='0') { cout<<"NG"<<endl; return; } else { sc=maze[sx][sy]; dfs(sx,sy); } //rep(i,w+1) //{ // rep(j,h+1) // { // cout<<maze[i][j]; // } // cout<<endl; //} if(maze[gx][gy]=='9') { cout<<"OK"<<endl; return; } else { cout<<"NG"<<endl; return; } } int main() { while(cin>>w>>h) { if(w==0 && h==0) { return 0; } else { solve(); } } return 0; }
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include<iostream> #include<string> #include<string.h> #include<cstring> #include<cmath> #include<algorithm> #include<stdlib.h> #include<queue> #include<map> #include<vector> #include<list> #include<stack> #include<functional> | ^ a.cc:5:14: error: '#' is not followed by a macro parameter 5 | #define all(c) (c).begin(), (c).end() #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc: In function 'void solve()': a.cc:31:5: error: 'i' was not declared in this scope 31 | rep(i,101) rep(j,101) maze[i][j]='0'; | ^ a.cc:31:1: error: 'rep' was not declared in this scope 31 | rep(i,101) rep(j,101) maze[i][j]='0'; | ^~~
s831754423
p00207
C++
#include <iostream> &#160; using namespace std; &#160; int map[101][101]; int xg, yg; int w, h; int col; int dx[] = {0, 1, 0, -1}; int dy[] = {-1, 0, 1, 0}; bool flag; &#160; void dfs(int x, int y) { &#160;&#160;&#160;&#160;map[y][x] = 0; &#160; &#160;&#160;&#160;&#160;if (x == xg && y == yg) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (map[ny][nx] == col) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dfs(nx, ny); &#160;&#160;&#160;&#160;} } &#160; void setblock(int c, int d, int bx, int by) { &#160;&#160;&#160;&#160;int wlim = 4, hlim = 2; &#160; &#160;&#160;&#160;&#160;if (d == 1) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;wlim = 2; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;hlim = 4; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;for (int y = 0; y < hlim; y++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int x = 0; x < wlim; x++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;map[by + y][bx + x] = c; } &#160; &#160; int main() { &#160;&#160;&#160;&#160;while (cin >> w >> h, w || h) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int xs, ys; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int n; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int y = 0; y < h; y++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int x = 0; x < w; x++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;map[y][x] = 0; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cin >> xs >> ys >> xg >> yg >> n; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;xs--, ys--, xg--, yg--; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i < n; i++) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int c, d, x, y; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cin >> c >> d >> x >> y; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x--, y--;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;setblock(c, d, x, y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;col = map[ys][xs]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = false; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (col) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dfs(xs, ys); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (flag) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cout << "OK" << endl; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cout << "NG" << endl; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;return 0; }
a.cc:2:2: error: stray '#' in program 2 | &#160; | ^ a.cc:4:2: error: stray '#' in program 4 | &#160; | ^ a.cc:12:2: error: stray '#' in program 12 | &#160; | ^ a.cc:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:16:2: error: stray '#' in program 16 | &#160; | ^ a.cc:17:2: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:17:8: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:17:14: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:17:20: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:18:2: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:8: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:14: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:20: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:26: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:32: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:38: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:44: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:19:2: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:8: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:14: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:20: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:26: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:32: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:38: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:44: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:20:2: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:8: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:14: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:20: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:21:2: error: stray '#' in program 21 | &#160; | ^ a.cc:22:2: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:22:8: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:22:14: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:22:20: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:23:2: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:8: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:14: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:20: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:26: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:32: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:38: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:44: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:24:2: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:8: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:14: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:20: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:26: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:32: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:38: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:44: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:25:2: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:8: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:14: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:20: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:26: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:32: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:38: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:44: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:50: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:26:2: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:8: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:14: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:20: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:26: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:32: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:38: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:44: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:27:2: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:8: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:14: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:20: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:26: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:32: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:38: error: stray '#' i
s513836211
p00207
C++
#include <iostream> &#160; using namespace std; &#160; int map[101][101]; int xg, yg; int w, h; int col; int dx[] = {0, 1, 0, -1}; int dy[] = {-1, 0, 1, 0}; bool flag; &#160; void dfs(int x, int y) { &#160;&#160;&#160;&#160;map[y][x] = 0; &#160; &#160;&#160;&#160;&#160;if (x == xg && y == yg) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if (map[ny][nx] == col) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dfs(nx, ny); &#160;&#160;&#160;&#160;} } &#160; void setblock(int c, int d, int bx, int by) { &#160;&#160;&#160;&#160;int wlim = 4, hlim = 2; &#160; &#160;&#160;&#160;&#160;if (d == 1) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;wlim = 2; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;hlim = 4; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;for (int y = 0; y < hlim; y++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int x = 0; x < wlim; x++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;map[by + y][bx + x] = c; } &#160; &#160; int main() { &#160;&#160;&#160;&#160;while (cin >> w >> h, w || h) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int xs, ys; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int n; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int y = 0; y < h; y++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int x = 0; x < w; x++) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;map[y][x] = 0; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cin >> xs >> ys >> xg >> yg >> n; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;xs--, ys--, xg--, yg--; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i < n; i++) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int c, d, x, y; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cin >> c >> d >> x >> y; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x--, y--;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;setblock(c, d, x, y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;col = map[ys][xs]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = false; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (col) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dfs(xs, ys); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (flag) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cout << "OK" << endl; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cout << "NG" << endl; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;return 0; }
a.cc:2:2: error: stray '#' in program 2 | &#160; | ^ a.cc:4:2: error: stray '#' in program 4 | &#160; | ^ a.cc:12:2: error: stray '#' in program 12 | &#160; | ^ a.cc:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;map[y][x] = 0; | ^ a.cc:16:2: error: stray '#' in program 16 | &#160; | ^ a.cc:17:2: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:17:8: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:17:14: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:17:20: error: stray '#' in program 17 | &#160;&#160;&#160;&#160;if (x == xg && y == yg) { | ^ a.cc:18:2: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:8: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:14: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:20: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:26: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:32: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:38: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:18:44: error: stray '#' in program 18 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag = true; | ^ a.cc:19:2: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:8: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:14: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:20: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:26: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:32: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:38: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:19:44: error: stray '#' in program 19 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return ; | ^ a.cc:20:2: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:8: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:14: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:20:20: error: stray '#' in program 20 | &#160;&#160;&#160;&#160;} | ^ a.cc:21:2: error: stray '#' in program 21 | &#160; | ^ a.cc:22:2: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:22:8: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:22:14: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:22:20: error: stray '#' in program 22 | &#160;&#160;&#160;&#160;for (int i = 0; i < 4; i++) { | ^ a.cc:23:2: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:8: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:14: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:20: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:26: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:32: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:38: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:23:44: error: stray '#' in program 23 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int nx = x + dx[i]; | ^ a.cc:24:2: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:8: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:14: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:20: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:26: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:32: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:38: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:24:44: error: stray '#' in program 24 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int ny = y + dy[i]; | ^ a.cc:25:2: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:8: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:14: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:20: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:26: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:32: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:38: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:44: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:25:50: error: stray '#' in program 25 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | ^ a.cc:26:2: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:8: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:14: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:20: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:26: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:32: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:38: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:26:44: error: stray '#' in program 26 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nx < 0 || ny < 0 || nx >= w || ny >= h) | ^ a.cc:27:2: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:8: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:14: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:20: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:26: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:32: error: stray '#' in program 27 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; | ^ a.cc:27:38: error: stray '#' i
s760944637
p00207
C++
int map[100][100]; bool visited[100][100]; int w,h; int xs,ys; int xg,yg; int n; int dfs(int x,int y) { static int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1}; if(x==xg&&y==yg) return 1; visited[x][y]=true; for(int i=0;i<4;i++) { int nx=x+dx[i],ny=y+dy[i]; if(0<=nx&&nx<w&&0<=ny&&ny<h&&map[x][y]==map[nx][ny]&&!visited[nx][ny]) { if(dfs(nx,ny)) return 1; } } return 0; } int main() { int c,d,x,y; while(1) { memset(map,0,sizeof(map)); memset(visited,0,sizeof(visited)); scanf("%d %d",&w,&h); if(w==0&&h==0) break; scanf("%d %d",&xs,&ys);xs--;ys--; scanf("%d %d",&xg,&yg);xg--;yg--; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d %d %d %d",&c,&d,&x,&y);x--;y--; int X,Y; if(d==1) { X=2;Y=4; }else { X=4;Y=2; } for(int j=0;j<X;j++) { for(int k=0;k<Y;k++) { map[x+j][y+k]=c; } } } printf("%s\n",dfs(xs,ys)?"OK":"NG"); } }
a.cc: In function 'int main()': a.cc:25:17: error: 'memset' was not declared in this scope 25 | memset(map,0,sizeof(map)); | ^~~~~~ a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int map[100][100]; a.cc:27:17: error: 'scanf' was not declared in this scope 27 | scanf("%d %d",&w,&h); | ^~~~~ a.cc:46:17: error: 'printf' was not declared in this scope 46 | printf("%s\n",dfs(xs,ys)?"OK":"NG"); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int map[100][100];
s529950214
p00207
C++
#include <iostream> #include <algorithm> using namespace std; int w,h,sx,sy,gx,gy; int mas[101][101],used[101][101]; int dx[] = {0,1,0,-1},dy[] = {1,0,-1,0}; void make_map(int x,int y,int chk,int color){ if(chk == 0){ for(int i=y;i<y+2;i++){ for(int j=x;j<x+4;j++) mas[i][j] = color; } } else { for(int i=y;i<y+4;i++){ for(int j=x;j<x+2;j++) mas[i][j] = color; } } } bool dfs(int x,int y){ used[y][x] = true; if(x == gx && y == gy) return true; for(int i=0;i<4;i++){ int nx = x + dx[i]; int ny = y + dy[i]; if(nx >= 0 && nx < w && ny >= 0 && ny < h && mas[ny][nx] == mas[sy][sx] && !used[ny][nx]) dfs(nx,ny); } return used[gy][gx]; } int main(){ int n; while(cin >> w >> h,w||h){ fill_n(mas[0],101*101,0); memset(used,false,sizeof(used)); cin >> sx >> sy >> gx >> gy >> n; --sx; --sy; --gx; --gy; while(n--){ int c,d,x,y; cin >> c >> d >> x >> y; --x; --y; make_map(x,y,d,c); } cout << (dfs(sx,sy)? "OK" : "NG") << endl; } }
a.cc: In function 'int main()': a.cc:37:5: error: 'memset' was not declared in this scope 37 | memset(used,false,sizeof(used)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | using namespace std;
s752968319
p00207
C++
#include<iostream> using namespace std; int a[200][200]={},sx,sy,gx,gy; int f(int i,int j){ if(i==gy && j==gx) return 1; if(a[i+1][j]==a[sy][sx]) if(f(i+1,j)==1) return 1; if(a[i][j+1]==a[sy][sx]) if(f(i,j+1)==1) return 1; if(a[i-1][j]==a[sx][sy]) if(f(i-1,j)==1) return 1; if(a[i][j-1]==a[sx][sy]) if(f(i,j-1)==1) return 1; return 0; } int main(){ while(1){ int w,h,n,c,d,x,y; cin>>w>>h; if(w==0 && h==0) break; for(int i=0;i<h;i++) for(int j=0;j<w;j++) a[i][j]=0; cin>>sx>>sy; cin>>gx>>gy; cin>>n; for(int i=0;i<n;i++){ cin>>c>>d>>x>>y; if(d==0){ for(int i=0;i<2;i++) for(int j=0;j<4;j++) a[y+i][x+j]=c; } if(d==1){ for(int i=0;i<4;i++) for(int j=0;j<2;j++) a[y+i][x+j]=c; } } if(a[sx][sy]!=a[gx][gy]) cout<<"NG"<<endl; else if(f(sy,sx)==0) cout<<"NG"<<endl; else if(f(sx,sy)==1) cout<<"OK"<<endl; } return 0; } +-
a.cc:55:1: error: expected unqualified-id before '+' token 55 | +- | ^
s326490672
p00208
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main2 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; while(true){ line = br.readLine(); int num = Integer.valueOf(line); if(num == 0){ break; } System.out.println(getNewNum2(num)); } } /* private static long getNewNum(int target){ long cnt = 0; for(long i = 1; ; i++){ String str = String.valueOf(i + cnt); if(str.contains("4") || str.contains("6")){ cnt++; continue; } if(i == target){ return i + cnt; } } }*/ private static long getNewNum2(int target){ int[] tb = {0, 1, 2, 3, 5, 7, 8, 9}; String str = Integer.toOctalString(target); String result = ""; for(String s : str.split("")){ int i = Integer.parseInt(s); result = result + tb[i]; } return Long.parseLong(result); } }
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s578248767
p00208
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main2 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; while(true){ line = br.readLine(); int num = Integer.valueOf(line); if(num == 0){ break; } System.out.println(getNewNum2(num)); } } private static long getNewNum2(int target){ int[] tb = {0, 1, 2, 3, 5, 7, 8, 9}; String str = Integer.toOctalString(target); String result = ""; for(String s : str.split("")){ int i = Integer.parseInt(s); result = result + tb[i]; } return Long.parseLong(result); } }
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s090674318
p00208
Java
15 100 1000000000 3 0
Main.java:1: error: class, interface, enum, or record expected 15 ^ 1 error
s682909743
p00208
C
#include <stdio.h> #include <string.h> #define MAX (9358757000) int main(void) { int i, j, k; unsigned long long int num[10000000000]; int n; int flag; int temp memset(j, 0, sizeof(j)) k = 1; for(j = 0; j < 1000000000; j++){ flag = 0; j = temp while (temp /= 10 != 0){ if (j % 4 == 0){ k++; break; } else if(j % 6 == 0){ k++; break; } } num[j] = k; k++; } while (1){ scanf("%d", &n); if(n == 0){ break; } printf("%u\n", num[n - 1]); }
main.c: In function 'main': main.c:14:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'memset' 14 | memset(j, 0, sizeof(j)) | ^~~~~~ main.c:14:16: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Wint-conversion] 14 | memset(j, 0, sizeof(j)) | ^ | | | int In file included from main.c:2: /usr/include/string.h:61:28: note: expected 'void *' but argument is of type 'int' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ~~~~~~^~~ main.c:14:32: error: expected ';' before 'k' 14 | memset(j, 0, sizeof(j)) | ^ | ; 15 | k = 1; | ~ main.c:19:21: error: 'temp' undeclared (first use in this function) 19 | j = temp | ^~~~ main.c:19:21: note: each undeclared identifier is reported only once for each function it appears in main.c:19:25: error: expected ';' before 'while' 19 | j = temp | ^ | ; 20 | while (temp /= 10 != 0){ | ~~~~~ main.c:42:9: error: expected declaration or statement at end of input 42 | } | ^
s563306564
p00208
C
main() { int n; while (scanf("%d", &n), n) { int t[10], d; for (d = 0; n; ++d, n /= 8) t[d] = n % 8; for (int i = d-1; i >= 0; --i) printf("%d", t[i] >= 5 ? t[i]+2 : t[i] == 4 ? t[i]+1 : t[i]); printf("\n"); } return 0; }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main() | ^~~~ main.c: In function 'main': main.c:4:16: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 4 | while (scanf("%d", &n), n) | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main() main.c:4:16: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 4 | while (scanf("%d", &n), n) | ^~~~~ main.c:4:16: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:10:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 10 | printf("%d", t[i] >= 5 ? t[i]+2 : t[i] == 4 ? t[i]+1 : t[i]); | ^~~~~~ main.c:10:25: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:10:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:10:25: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:11:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 11 | printf("\n"); | ^~~~~~ main.c:11:17: note: include '<stdio.h>' or provide a declaration of 'printf'
s199473614
p00208
C
#include<stdio.h> int main(){ int i,j,b[10],f=0,c=0; long a[10],num; a[0]=1; for(i=1;i<10;i++){ a[i]=a[i-1]*8; } for(i=0;i<10;i++){ b[i]=0; } for(;;){ scanf("%ld",&num); if(num==0){ break; } for(i=9;i>=0;i--){ while(f==0){ if(num>=a[i]){ num-=a[i]; c++; }else{ b[i]=c; c=0; f=1; } } f=0; } f=0; i=9; while(f==0){ if(b[i]!=0){ f=1; j=i; } i--; } for(i=j;i>=0;i--){ if(b[i]==4){ b[i]+=1; printf("%d",b[i]); }else if(b[i]>=5){ b[i]+=2; printf("%d",b[i]); }else{ printf("%d",b[i]); } } printf("\n"); }      return 0; }
main.c: In function 'main': main.c:53:1: error: stray '\343' in program 53 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:53:3: error: stray '\343' in program 53 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:53:5: error: stray '\343' in program 53 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:53:7: error: stray '\343' in program 53 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:53:9: error: stray '\343' in program 53 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~
s829701998
p00208
C++
#include <iostream> #include <cstdlib> using namespace std; int main(void) { // itoa int n; while (cin >> n, n){ char s[20]; itoa(n, s, 8); string str = s; for (int i = 0; i < str.length(); i++){ if ('4' <= str[i]) str[i]++; if ('6' <= str[i]) str[i]++; } cout << str << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: 'itoa' was not declared in this scope 12 | itoa(n, s, 8); | ^~~~
s479031300
p00208
C++
#include <iostream> #include <cstdlib> using namespace std; int main(void) { // itoa int n; while (cin >> n, n){ char s[20]; _itoa(n, s, 8); string str = s; for (int i = 0; i < str.length(); i++){ if ('4' <= str[i]) str[i]++; if ('6' <= str[i]) str[i]++; } cout << str << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: '_itoa' was not declared in this scope 12 | _itoa(n, s, 8); | ^~~~~
s587637480
p00208
C++
#include<iostream> using namespace std; int main(void){ int num[] = {1,2,3,5,6,7,8,9}; int n; while(cin>>n,n){ long long a=0,d=1; while(n){ a+=nums[n%8]*d; d*=10; n/=8; } cout<<a<<endl; } }
a.cc: In function 'int main()': a.cc:10:10: error: 'nums' was not declared in this scope; did you mean 'num'? 10 | a+=nums[n%8]*d; | ^~~~ | num
s366323702
p00208
C++
#include <iostream> using namespace std; int main(){ long ans=0; int c=0; int n; while(cin>>n){ ans+=n%8*pow(10,c); n/=8; if(n==0)break; c++; } for(int i=0;i<=c;i++){ int temp=((long)(ans/pow(10,i))%10); if(temp==4)ans+=pow(10,i); if(temp>=5)ans+=2*pow(10,i); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:18: error: 'pow' was not declared in this scope 11 | ans+=n%8*pow(10,c); | ^~~ a.cc:17:30: error: 'pow' was not declared in this scope 17 | int temp=((long)(ans/pow(10,i))%10); | ^~~
s059505203
p00208
C++
#include <iostream> using namespace std; int main() { long long ans; int i,k,n,o[10]; for (i=1,o[0]=1;i<10;i++) o[i]=o[i-1]*8; while(cin >> n && n>0) { ans=0; for (i=9;i>=0;i--) { if (n>=o[i]) { k=n / o[i]; n=n % o[i]; if (k==4) k=5; else if (k>4) k+=2; ans+=k; } if (i>0) ans=ans*10; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:2: error: expected '}' at end of input 18 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s576168024
p00208
C++
#include <stdio.h> int main(void) { int i; char ans[10]; while(scanf("%d",&i),i){ sprintf(a,"%o",i); for(i=0;i<10;i++){ if(ans[i]>=4) ans[i]++; if(ans[i]>=6) ans[i]++; } printf("%s\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'a' was not declared in this scope 7 | sprintf(a,"%o",i); | ^
s505003161
p00208
C++
#include <stdio.h> int main(void) { int i; char ans[10]; while(scanf("%d",&i),i){ sprintf(ans,"%o",i); for(i=0;i<10;i++){ if(ans[i]>=4) ans[i]++; if(ans[i]>=6) ans[i]++; if(ans[i]==0) break } printf("%s\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:11:20: error: expected ';' before '}' token 11 | if(ans[i]==0) break | ^ | ; 12 | } | ~
s840631043
p00208
C++
#include <stdio.h> int main(void) { int i; char ans[10]; while(scanf("%d",&i),i){ sprintf(ans,"%o",i); for(i=0;i<10;i++){ if(ans[i]==0) break if(ans[i]>=4) ans[i]++; if(ans[i]>=6) ans[i]++; } printf("%s\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:9:20: error: expected ';' before 'if' 9 | if(ans[i]==0) break | ^ | ; 10 | 11 | if(ans[i]>=4) ans[i]++; | ~~
s958552495
p00208
C++
import java.util.Scanner; import java.util.ArrayList; import java.util.Stack; class Main{ public static void main(String[] args){ Solve s = new Solve(); s.solve(); } } class Solve{ Solve(){} Scanner in = new Scanner(System.in); void solve(){ while(in.hasNext()){ int n = in.nextInt(); if(n == 0) return; System.out.println(toOct(n)); } } String toOct(int n) { if(n == 0) return new String("0"); StringBuilder ret = new StringBuilder(); while(n > 0){ int m = n % 8; if(m >= 4) m++; if(m > 5) m++; ret.append((char)('0' + m)); n /= 8; } ret.reverse(); return ret.toString(); } }
a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ 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.util.ArrayList; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.Stack; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:15: error: expected ':' before 'static' 8 | public static void main(String[] args){ | ^~~~~~~ | : a.cc:8:33: error: 'String' has not been declared 8 | public static void main(String[] args){ | ^~~~~~ a.cc:8:42: error: expected ',' or '...' before 'args' 8 | public static void main(String[] args){ | ^~~~ a.cc:12:2: error: expected ';' after class definition 12 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:9:17: error: 'Solve' was not declared in this scope 9 | Solve s = new Solve(); | ^~~~~ a.cc:10:17: error: 's' was not declared in this scope 10 | s.solve(); | ^ a.cc: At global scope: a.cc:17:9: error: 'Scanner' does not name a type 17 | Scanner in = new Scanner(System.in); | ^~~~~~~ a.cc:29:9: error: 'String' does not name a type 29 | String toOct(int n) { | ^~~~~~ a.cc:43:2: error: expected ';' after class definition 43 | } | ^ | ; a.cc: In member function 'void Solve::solve()': a.cc:21:23: error: 'in' was not declared in this scope; did you mean 'int'? 21 | while(in.hasNext()){ | ^~ | int a.cc:24:25: error: 'System' was not declared in this scope 24 | System.out.println(toOct(n)); | ^~~~~~ a.cc:24:44: error: 'toOct' was not declared in this scope 24 | System.out.println(toOct(n)); | ^~~~~
s094206211
p00208
C++
#include<iostream> using namespace std; int main() { long long a[10], c = 1, d, e = 0; int b = 0; while (c <= 1000000000) { a[b] = c; b++; c *= 8; } while (cin >> d&&d != 0) { e = 0; int f = 0; for (int i = b-1; i >= 0; i--) { f = 0; if (a[i] <= d) { while (a[i] <= d) { f++; d -= a[i]; } if (f <= 3) e += (pow(10, i)*f); else if (f == 5) e += (pow(10, i)*(f + 2)); else if (f < 6) e += (pow(10, i)*(f + 1)); else if(f>=6) e += (pow(10, i)*(f + 2)); } } cout << e << endl; } }
a.cc: In function 'int main()': a.cc:22:47: error: 'pow' was not declared in this scope 22 | e += (pow(10, i)*f); | ^~~ a.cc:24:47: error: 'pow' was not declared in this scope 24 | e += (pow(10, i)*(f + 2)); | ^~~ a.cc:26:47: error: 'pow' was not declared in this scope 26 | e += (pow(10, i)*(f + 1)); | ^~~ a.cc:28:47: error: 'pow' was not declared in this scope 28 | e += (pow(10, i)*(f + 2)); | ^~~
s615426240
p00208
C++
#include<iostream> using namespace std; int main() { long long a[10], c = 1, d, e = 0; int b = 0; while (c <= 1000000000) { a[b] = c; b++; c *= 8; } while (cin >> d&&d != 0) { e = 0; int f = 0; for (int i = b-1; i >= 0; i--) { f = 0; if (a[i] <= d) { while (a[i] <= d) { f++; d -= a[i]; } if (f <= 3) e += (pow(10, i)*f); else if (f == 5) e += (pow(10, i)*(f + 2)); else if (f < 6) e += (pow(10, i)*(f + 1)); else if(f>=6) e += (pow(10, i)*(f + 2)); } } cout << e << endl; } }
a.cc: In function 'int main()': a.cc:22:47: error: 'pow' was not declared in this scope 22 | e += (pow(10, i)*f); | ^~~ a.cc:24:47: error: 'pow' was not declared in this scope 24 | e += (pow(10, i)*(f + 2)); | ^~~ a.cc:26:47: error: 'pow' was not declared in this scope 26 | e += (pow(10, i)*(f + 1)); | ^~~ a.cc:28:47: error: 'pow' was not declared in this scope 28 | e += (pow(10, i)*(f + 2)); | ^~~
s065832867
p00208
C++
#include <iostream> using namespace std; int main() { int i; char s[10]; while(cin>>i,i){ sprintf(s,"%o",i); for(i=0;s[i]!='\0';i++){ if(s[i]>='4')s[i]++; if(s[i]>='6')s[i]++; } printf("%s\n",ans); } }
a.cc: In function 'int main()': a.cc:12:19: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | printf("%s\n",ans); | ^~~ | abs
s906089820
p00208
C++
#include <iostream> using namespace std; long long int d8(long long int c, int n, int d) { int r2 = n % 8; if (r2 > 4) r2++; if (r2 > 3) r2++; c += r2 * pow(10,d - 1); if (n / 8 > 0) c = d8(c, n / 8, d + 1); return c; } int main() { int n; while (cin >> n && n != 0) { cout << d8(0, n, 1) << endl; } return 0; }
a.cc: In function 'long long int d8(long long int, int, int)': a.cc:10:19: error: 'pow' was not declared in this scope 10 | c += r2 * pow(10,d - 1); | ^~~
s342670887
p00208
C++
while(1): n = int(input()) if(not n): break print("".join("01235789"[int(i)] for i in oct(n)[2:]))
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while(1): | ^~~~~
s046025558
p00208
C++
#include <iostream> #include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef __int64 ll; //typedef long long ll; ll n; int main(){ while(cin>>n){ if(!n)return 0; ll m=n,d=1,p; while(m>7){m/=8;d++;} for(int i=d-1;i>=0;i--){ p=(n/(int)(pow(8,i)+0.1))%8; if(p<4)cout<<p; else if(p<5)cout<<p+1; else cout<<p+2; } cout<<endl; } }
a.cc:16:9: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | typedef __int64 ll; | ^~~~~~~ | __int64_t a.cc:18:1: error: 'll' does not name a type 18 | ll n; | ^~ a.cc: In function 'int main()': a.cc:21:20: error: 'n' was not declared in this scope; did you mean 'yn'? 21 | while(cin>>n){ | ^ | yn a.cc:23:17: error: 'll' was not declared in this scope 23 | ll m=n,d=1,p; | ^~ a.cc:24:23: error: 'm' was not declared in this scope; did you mean 'tm'? 24 | while(m>7){m/=8;d++;} | ^ | tm a.cc:24:33: error: 'd' was not declared in this scope 24 | while(m>7){m/=8;d++;} | ^ a.cc:25:27: error: 'd' was not declared in this scope 25 | for(int i=d-1;i>=0;i--){ | ^ a.cc:26:25: error: 'p' was not declared in this scope 26 | p=(n/(int)(pow(8,i)+0.1))%8; | ^
s337751811
p00208
C++
#inmport<cstdio> s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}
a.cc:1:2: error: invalid preprocessing directive #inmport; did you mean #import? 1 | #inmport<cstdio> | ^~~~~~~ | import a.cc:2:1: error: ISO C++ forbids declaration of 's' with no type [-fpermissive] 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^ a.cc: In function 'int s(int)': a.cc:2:24: error: 'printf' was not declared in this scope 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #inmport<cstdio> a.cc:2:65: warning: no return statement in function returning non-void [-Wreturn-type] 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^ a.cc: At global scope: a.cc:2:66: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~ a.cc: In function 'int main()': a.cc:2:83: error: 'scanf' was not declared in this scope 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~~ a.cc:2:100: error: 'puts' was not declared in this scope 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~
s241322326
p00208
C++
#import<cstdio> s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<cstdio> | ^~~~~~ a.cc:2:1: error: ISO C++ forbids declaration of 's' with no type [-fpermissive] 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^ a.cc: In function 'int s(int)': a.cc:2:65: warning: no return statement in function returning non-void [-Wreturn-type] 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^ a.cc: At global scope: a.cc:2:66: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~
s949048927
p00208
C++
#inmport<cstdio> void s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}
a.cc:1:2: error: invalid preprocessing directive #inmport; did you mean #import? 1 | #inmport<cstdio> | ^~~~~~~ | import a.cc: In function 'void s(int)': a.cc:2:29: error: 'printf' was not declared in this scope 2 | void s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #inmport<cstdio> a.cc: At global scope: a.cc:2:71: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | void s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~ a.cc: In function 'int main()': a.cc:2:88: error: 'scanf' was not declared in this scope 2 | void s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~~ a.cc:2:105: error: 'puts' was not declared in this scope 2 | void s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~
s988988842
p00208
C++
#import<cstdio> t[]={0,1,2,3,5,7,8,9}; void s(int n){if(n>7)s(n/8);printf("%d",t[n%8]);} main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<cstdio> | ^~~~~~ a.cc:2:1: error: 't' does not name a type 2 | t[]={0,1,2,3,5,7,8,9}; | ^ a.cc: In function 'void s(int)': a.cc:3:41: error: 't' was not declared in this scope 3 | void s(int n){if(n>7)s(n/8);printf("%d",t[n%8]);} | ^ a.cc: At global scope: a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~
s361384155
p00208
C++
#import<cstdio> int t[]={,1,2,3,5,7,8,9,};void s(int n){if(n>7)s(n/8);printf("%d",t[n%8]);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated] 1 | #import<cstdio> | ^~~~~~ a.cc:2:10: error: expected primary-expression before ',' token 2 | int t[]={,1,2,3,5,7,8,9,};void s(int n){if(n>7)s(n/8);printf("%d",t[n%8]);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^ a.cc:2:76: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | int t[]={,1,2,3,5,7,8,9,};void s(int n){if(n>7)s(n/8);printf("%d",t[n%8]);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);} | ^~~~
s565972192
p00208
C++
#include<iostream> int n; int pw[10] = {1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000}; void solve(){ __int64 ans = 0; int tmp = n; for(int i=0; i<10; i++){ int temp = tmp%8; if(temp==4) temp++; else if(temp > 4) temp+=2; ans += temp*pw[i]; tmp = tmp/8; if(tmp == 0) break; } std::cout << ans << std::endl; } int main(){ while(true){ std::cin >> n; if(!n) return 0; solve(); } }
a.cc: In function 'void solve()': a.cc:7:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | __int64 ans = 0; | ^~~~~~~ | __int64_t a.cc:15:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | ans += temp*pw[i]; | ^~~ | abs a.cc:20:22: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | std::cout << ans << std::endl; | ^~~ | abs
s249471878
p00208
C++
1>------ ƒrƒ‹ƒhŠJŽn: ƒvƒƒWƒFƒNƒg: algo, \¬: Release Win32 ------ 1>2011/07/23 16:18:47 ‚Ƀrƒ‹ƒh‚ðŠJŽn‚µ‚Ü‚µ‚½B 1>InitializeBuildStatus: 1> "AlwaysCreate" ‚ªŽw’肳‚ꂽ‚½‚ß "Release\algo.unsuccessfulbuild" ‚ðì¬‚µ‚Ä‚¢‚Ü‚·B 1>ClCompile: 1> 0208.cpp 1>Link: 1> ƒR[ƒh¶¬‚µ‚Ä‚¢‚Ü‚·B 1> ƒR[ƒh¶¬‚ªI—¹‚µ‚Ü‚µ‚½B 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe 1>FinalizeBuildStatus: 1> ƒtƒ@ƒCƒ‹ "Release\algo.unsuccessfulbuild" ‚ðíœ‚µ‚Ä‚¢‚Ü‚·B 1> "Release\algo.lastbuildstate" ‚̃^ƒbƒ` ƒ^ƒXƒN‚ðŽÀs‚µ‚Ä‚¢‚Ü‚·B 1> 1>ƒrƒ‹ƒh‚ɐ¬Œ÷‚µ‚Ü‚µ‚½B 1> 1>Œo‰ßŽžŠÔ 00:00:02.16 ========== ƒrƒ‹ƒh: 1 ³íI—¹A0 ޏ”sA0 XV•s—vA0 ƒXƒLƒbƒv ==========
a.cc:1:10: error: extended character ƒ is not valid in an identifier 1 | 1>------ ƒrƒ‹ƒhŠJŽn: ƒvƒƒWƒFƒNƒg: algo, \¬: Release Win32 ------ | ^ a.cc:1:10: error: extended character ƒ is not valid in an identifier a.cc:1:10: error: extended character ‹ is not valid in an identifier a.cc:1:10: error: extended character ƒ is not valid in an identifier a.cc:1:10: error: extended character Š is not valid in an identifier a.cc:1:10: error: extended character Ž is not valid in an identifier a.cc:1:22: error: extended character ƒ is not valid in an identifier 1 | 1>------ ƒrƒ‹ƒhŠJŽn: ƒvƒƒWƒFƒNƒg: algo, \¬: Release Win32 ------ | ^ a.cc:1:22: error: extended character ƒ is not valid in an identifier a.cc:1:22: error: extended character  is not valid in an identifier a.cc:1:22: error: extended character ƒ is not valid in an identifier a.cc:1:22: error: extended character ƒ is not valid in an identifier a.cc:1:22: error: extended character ƒ is not valid in an identifier a.cc:1:22: error: extended character ƒ is not valid in an identifier a.cc:1:42: error: extended character  is not valid in an identifier 1 | 1>------ ƒrƒ‹ƒhŠJŽn: ƒvƒƒWƒFƒNƒg: algo, \¬: Release Win32 ------ | ^ a.cc:1:43: error: stray '\' in program 1 | 1>------ ƒrƒ‹ƒhŠJŽn: ƒvƒƒWƒFƒNƒg: algo, \¬: Release Win32 ------ | ^ a.cc:1:44: error: extended character  is not valid in an identifier 1 | 1>------ ƒrƒ‹ƒhŠJŽn: ƒvƒƒWƒFƒNƒg: algo, \¬: Release Win32 ------ | ^ a.cc:1:44: error: extended character ¬ is not valid in an identifier a.cc:2:23: error: extended character ‚ is not valid in an identifier 2 | 1>2011/07/23 16:18:47 ‚Ƀrƒ‹ƒh‚ðŠJŽn‚µ‚Ü‚µ‚½B | ^ a.cc:2:23: error: extended character ƒ is not valid in an identifier a.cc:2:23: error: extended character ƒ is not valid in an identifier a.cc:2:23: error: extended character ‹ is not valid in an identifier a.cc:2:23: error: extended character ƒ is not valid in an identifier a.cc:2:23: error: extended character ‚ is not valid in an identifier a.cc:2:23: error: extended character Š is not valid in an identifier a.cc:2:23: error: extended character Ž is not valid in an identifier a.cc:2:23: error: extended character ‚ is not valid in an identifier a.cc:2:23: error: extended character ‚ is not valid in an identifier a.cc:2:23: error: extended character ‚ is not valid in an identifier a.cc:2:23: error: extended character ‚ is not valid in an identifier a.cc:2:23: error: extended character  is not valid in an identifier a.cc:4:20: error: extended character ‚ is not valid in an identifier 4 | 1> "AlwaysCreate" ‚ªŽw’肳‚ꂽ‚½‚ß "Release\algo.unsuccessfulbuild" ‚ðì¬‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:4:20: error: extended character Ž is not valid in an identifier a.cc:4:20: error: extended character ’ is not valid in an identifier a.cc:4:20: error: extended character ‚ is not valid in an identifier a.cc:4:20: error: extended character ‚ is not valid in an identifier a.cc:4:20: error: extended character ‚ is not valid in an identifier a.cc:4:20: error: extended character ‚ is not valid in an identifier a.cc:4:20: error: extended character ‚ is not valid in an identifier a.cc:4:70: error: extended character ‚ is not valid in an identifier 4 | 1> "AlwaysCreate" ‚ªŽw’肳‚ꂽ‚½‚ß "Release\algo.unsuccessfulbuild" ‚ðì¬‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:4:70: error: extended character  is not valid in an identifier a.cc:4:70: error: extended character  is not valid in an identifier a.cc:4:70: error: extended character ¬ is not valid in an identifier a.cc:4:70: error: extended character ‚ is not valid in an identifier a.cc:4:70: error: extended character ‚ is not valid in an identifier a.cc:4:70: error: extended character ‚ is not valid in an identifier a.cc:4:70: error: extended character ¢ is not valid in an identifier a.cc:4:70: error: extended character ‚ is not valid in an identifier a.cc:4:70: error: extended character ‚ is not valid in an identifier a.cc:4:70: error: extended character  is not valid in an identifier a.cc:8:5: error: extended character ƒ is not valid in an identifier 8 | 1> ƒR[ƒh¶¬‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:8:5: error: extended character  is not valid in an identifier a.cc:8:9: error: extended character ƒ is not valid in an identifier 8 | 1> ƒR[ƒh¶¬‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:8:9: error: extended character  is not valid in an identifier a.cc:8:9: error: extended character ¶ is not valid in an identifier a.cc:8:9: error: extended character  is not valid in an identifier a.cc:8:9: error: extended character ¬ is not valid in an identifier a.cc:8:9: error: extended character ‚ is not valid in an identifier a.cc:8:9: error: extended character ‚ is not valid in an identifier a.cc:8:9: error: extended character ‚ is not valid in an identifier a.cc:8:9: error: extended character ¢ is not valid in an identifier a.cc:8:9: error: extended character ‚ is not valid in an identifier a.cc:8:9: error: extended character ‚ is not valid in an identifier a.cc:8:9: error: extended character  is not valid in an identifier a.cc:9:5: error: extended character ƒ is not valid in an identifier 9 | 1> ƒR[ƒh¶¬‚ªI—¹‚µ‚Ü‚µ‚½B | ^ a.cc:9:5: error: extended character  is not valid in an identifier a.cc:9:9: error: extended character ƒ is not valid in an identifier 9 | 1> ƒR[ƒh¶¬‚ªI—¹‚µ‚Ü‚µ‚½B | ^ a.cc:9:9: error: extended character  is not valid in an identifier a.cc:9:9: error: extended character ¶ is not valid in an identifier a.cc:9:9: error: extended character  is not valid in an identifier a.cc:9:9: error: extended character ¬ is not valid in an identifier a.cc:9:9: error: extended character ‚ is not valid in an identifier a.cc:9:9: error: extended character  is not valid in an identifier a.cc:9:9: error: extended character — is not valid in an identifier a.cc:9:9: error: extended character ‚ is not valid in an identifier a.cc:9:9: error: extended character ‚ is not valid in an identifier a.cc:9:9: error: extended character ‚ is not valid in an identifier a.cc:9:9: error: extended character ‚ is not valid in an identifier a.cc:9:9: error: extended character  is not valid in an identifier a.cc:10:23: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:29: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:34: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:44: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:63: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:72: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:77: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:10:85: error: stray '\' in program 10 | 1> algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe | ^ a.cc:12:5: error: extended character ƒ is not valid in an identifier 12 | 1> ƒtƒ@ƒCƒ‹ "Release\algo.unsuccessfulbuild" ‚ðíœ‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:12:5: error: extended character ƒ is not valid in an identifier a.cc:12:8: error: stray '@' in program 12 | 1> ƒtƒ@ƒCƒ‹ "Release\algo.unsuccessfulbuild" ‚ðíœ‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:12:9: error: extended character ƒ is not valid in an identifier 12 | 1> ƒtƒ@ƒCƒ‹ "Release\algo.unsuccessfulbuild" ‚ðíœ‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:12:9: error: extended character ƒ is not valid in an identifier a.cc:12:9: error: extended character ‹ is not valid in an identifier a.cc:12:47: error: extended character ‚ is not valid in an identifier 12 | 1> ƒtƒ@ƒCƒ‹ "Release\algo.unsuccessfulbuild" ‚ðíœ‚µ‚Ä‚¢‚Ü‚·B | ^ a.cc:12:47: error: extended character  is not valid in an identifier a.cc:12:47: error: extended character  is not valid in an identifier a.cc:12:47: error: extended character œ is not valid in an identifier a.cc:12:47: error: extended character ‚ is not valid in an identifier a.cc:12:47: error: extended character ‚ is not valid in an identifier a.cc:12:47: error: extended character ‚ is not valid in an identifier a.cc:12:47: error: extended character ¢ is not valid in an identifier a.cc:12:47: error: extended character ‚ is not valid in an identifier a.cc:12:47: error: extended character ‚ is not valid in an identifier a.cc:12:47: error: extended character  is not valid in an identifier a.cc:13:35: error: extended character ‚ is not valid in an identifier 13 | 1> "Release\algo.lastbuildstate" ‚̃^ƒbƒ
s027819241
p00208
C++
tw
a.cc:1:1: error: 'tw' does not name a type 1 | tw | ^~
s265984389
p00208
C++
#include<iostream> #include<sstream> #include<algorithm> using namespace std; const string s = "01235789" int main(){ int n; while(cin >> n, n){ stringstream ss; while(n){ ss << s[n % 8]; n /= 8; } string ans = ss.str(); reverse(ans.begin(), ans.end()); cout << ans << endl; } return 0; }
a.cc:9:1: error: expected ',' or ';' before 'int' 9 | int main(){ | ^~~
s936848611
p00208
C++
#include<iostream> #define N 1000000000 using namespace std; int data[N]; int check(int n, int keta){ for(int i = 0; i < keta; i++){ if(n%10 == 4 || n%10 == 6) return 0; n/=10; } return 1; } void make(){ int num = 0; int keta = 1; for(int i = 0; i < N; i++){ num++; if(num == 10) keta++; if(num == 100) keta++; if(num == 1000) keta++; if(num == 10000) keta++; if(num == 100000) keta++; if(num == 1000000) keta++; if(num == 10000000) keta++; if(num == 100000000) keta++; if(check(num,keta)) data[i] = num; else i--; } } int main(){ make(); int in; while(cin >> in && in) cout << data[in-1] << endl; return 0; }
a.cc: In function 'void make()': a.cc:31:25: error: reference to 'data' is ambiguous 31 | if(check(num,keta)) data[i] = num; | ^~~~ 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:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:5: note: 'int data [1000000000]' 7 | int data[N]; | ^~~~ a.cc: In function 'int main()': a.cc:39:34: error: reference to 'data' is ambiguous 39 | while(cin >> in && in) cout << data[in-1] << endl; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:5: note: 'int data [1000000000]' 7 | int data[N]; | ^~~~
s941253688
p00208
C++
#include <iostream> #include <string> using namespace std; int main() { long long int n, r; string s=""; char x[sizeof(int)]; while(cin >> n) { if(!n) break; r=0; for(int i=0; i<n; i++) { while(1) { r++; sprintf(x, "%d", r); if(!(strchr(x, '4')!=NULL)&&!(strchr(x, '6')!=NULL)) break; } } cout << x << endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:38: error: 'strchr' was not declared in this scope 21 | if(!(strchr(x, '4')!=NULL)&&!(strchr(x, '6')!=NULL)) | ^~~~~~ a.cc:2:1: note: 'strchr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #include <string>
s828982528
p00208
C++
#define _USE_MATH_DEFINES #define INF 10000000 #include <iostream> #include <sstream> #include <cmath> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> using namespace std; typedef long long ll; typedef pair<int,int> P; static const double eps = 1e-8; int main(){ const char oct[] = {'0','1','2','3','5','7','8','9'}; ll n; while(~scanf("%lld",&n)){ if(n==0) break; char buf[11]; sprintf(buf,"%llo",n); for(int i=10;i>=0;i--){ if(buf[i]-'0' < 0 || buf[i]-'0' >= 8) continue; buf[i] = oct[buf[i]-'0']; } printf("%s",buf) } }
a.cc: In function 'int main()': a.cc:37:33: error: expected ';' before '}' token 37 | printf("%s",buf) | ^ | ; 38 | } | ~
s495806904
p00208
C++
#include <iostream> #include <string> #include <cmath> using namespace std; string toOct(long long d) { char c[30]; string s = ""; sprintf_s(c, "%o", d); s += c; return s; } string solve(long long n) { char c[30]; string s; s = toOct(n); for( int i = 0; i < (int)s.length(); i++) { if( s[i] >= '4' ) s[i] += '1' - '0'; if( s[i] >= '6' ) s[i] += '1' - '0'; } return s; } int main() { long long n; while( cin >> n, n) { cout << solve(n) << endl; } return 0; }
a.cc: In function 'std::string toOct(long long int)': a.cc:12:9: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'? 12 | sprintf_s(c, "%o", d); | ^~~~~~~~~ | sprintf
s494597390
p00208
C++
#include <iostream> #include <string> #include <cstring> #include <cmath> using namespace std; string toOct(long long d) { char c[30]; string s = ""; sprintf_s(c, "%o", d); s += c; return s; } string solve(long long n) { char c[30]; string s; s = toOct(n); for( int i = 0; i < (int)s.length(); i++) { if( s[i] >= '4' ) s[i] += '1' - '0'; if( s[i] >= '6' ) s[i] += '1' - '0'; } return s; } int main() { long long n; while( cin >> n, n) { cout << solve(n) << endl; } return 0; }
a.cc: In function 'std::string toOct(long long int)': a.cc:13:9: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'? 13 | sprintf_s(c, "%o", d); | ^~~~~~~~~ | sprintf
s905263292
p00208
C++
#include <iostream> using namespace std; int main(){char s[]={'0','1','2','3','5','7','8','9'};int n;for(;cin>>n,n;cout<<a<<endl)for(string a="";n>0;n/=8)a=s[n%8]+a;}
a.cc: In function 'int main()': a.cc:3:82: error: 'a' was not declared in this scope 3 | int main(){char s[]={'0','1','2','3','5','7','8','9'};int n;for(;cin>>n,n;cout<<a<<endl)for(string a="";n>0;n/=8)a=s[n%8]+a;} | ^
s928174378
p00208
C++
#include<iostream> using namespace std; const int table[] = { 1,2,3,4,5,6,7,8,9 }; void surgeon(int x) { if(x>=8) { surgeon(n/8); } return(table[n%8]); } int main() { int n; while(cin>>n, n>0) { surgeon(n); cout<<endl; } return 0; }
a.cc: In function 'void surgeon(int)': a.cc:9:11: error: 'n' was not declared in this scope 9 | surgeon(n/8); | ^ a.cc:11:15: error: 'n' was not declared in this scope 11 | return(table[n%8]); | ^
s833252267
p00208
C++
#include<iostream> using namespace std; const int table[] = { 1,2,3,4,5,6,7,8,9 }; void surgeon(int x) { if(x>=8) { surgeon(x/8); } return(table[x%8]); } int main() { int x; while(cin>>x, x>0) { surgeon(n); cout<<endl; } return 0; }
a.cc: In function 'void surgeon(int)': a.cc:11:18: error: return-statement with a value, in function returning 'void' [-fpermissive] 11 | return(table[x%8]); | ~~~~~~~~~~^~ a.cc: In function 'int main()': a.cc:18:11: error: 'n' was not declared in this scope 18 | surgeon(n); | ^
s093304191
p00208
C++
#include<iostream> using namespace std; const int table[] = { 1,2,3,4,5,6,7,8,9 }; void surgeon(int x) { if(x>=8) { surgeon(x/8); } return(table[x%8]); } int main() { int x; while(cin>>x, x>0) { surgeon(x); cout<<endl; } return 0; }
a.cc: In function 'void surgeon(int)': a.cc:11:18: error: return-statement with a value, in function returning 'void' [-fpermissive] 11 | return(table[x%8]); | ~~~~~~~~~~^~
s222961656
p00208
C++
#include<iostream> int main(){ while(1){ int a; std::cin>>a; double int b=1; if(a==0)break; for(int i=0;i<a;i++){ b++; int n=10; for(int j=0;j<10;j++){ while(a%n==4||a%6==&||a/n==4||a/n==6){ b++; } } } std::cout<<b<<std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:17: error: two or more data types in declaration of 'b' 6 | double int b=1; | ^~~~~~ a.cc:9:25: error: 'b' was not declared in this scope 9 | b++; | ^ a.cc:12:53: error: expected primary-expression before '||' token 12 | while(a%n==4||a%6==&||a/n==4||a/n==6){ | ^~ a.cc:17:28: error: 'b' was not declared in this scope 17 | std::cout<<b<<std::endl; | ^
s257586199
p00209
Java
import java.util.*; class Main { static int[][] map; static int[][] cx; public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); while (true) { int n = stdIn.nextInt(); int m = stdIn.nextInt(); if (n == 0 && m == 0){ break; } map = new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { map[i][j] = stdIn.nextInt(); } } cx = new int[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { cx[i][j] = stdIn.nextInt(); } } int GX = 999999; int GY = 999999; for (int i = 0; i < 5; i++) { if (check()) { GX = Math.min(GX, x); GY = Math.min(GY, y); } rotate(cx); } if(x == -1 && y == -1) { System.out.println("NA"); } else { System.out.println(GX+1 + " " + GY+1); } } } } static void rotate(int[][] a) { int[][] newMap = new int[a.length][a.length]; for(int i = 0; i < a.length; i++) { for(int j = 0; j < a.length; j++) { newMap[a.length - j - 1][i] = a[i][j]; } } cx = newMap; } static int x; static int y; static boolean check() { x = -1; y = -1; for(int i = 0; i < map.length; i++) { for(int j = 0; j < map.length; j++) { boolean check = true; int lasty = -1; int lastx = -1; OUT:for(int k = 0; k < cx.length; k++) { for(int l = 0; l < cx.length; l++) { if(cx[k][l] == -1) continue; if(lasty == -1 && lastx == -1) { lasty = k; lastx = l; } if(i+k >= map.length || j + l >= map.length) { check = false; break OUT; } if(map[i+k][j+l] != cx[k][l]) { check = false; break OUT; } } } if(check) { y = i + lasty; x = j + lastx; return true; } } } return false; } }
Main.java:48: error: unnamed classes are a preview feature and are disabled by default. static void rotate(int[][] a) { ^ (use --enable-preview to enable unnamed classes) Main.java:93: error: class, interface, enum, or record expected } ^ 2 errors
s658850574
p00209
Java
import java.util.Scanner; public class A0209 { static int n, m; static int win[][], pic[][]; public static boolean search(int x, int y) { for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { if (pic[i][j] != -1 && win[y + i][x + j] != pic[i][j]) { return false; } } } return true; } public static int[][] turn() { int a[][] = new int[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { a[m - j - 1][i] = pic[i][j]; } } return a; } public static void ans(int x, int y) { for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { if (pic[i][j] != -1) { System.out.println((x + j) + " " + (y + i)); return ; } } } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); L: while (true) { n = sc.nextInt(); m = sc.nextInt(); if ((n | m) == 0) { break; } win = new int[n][n]; pic = new int[m][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { win[i][j] = sc.nextInt(); } } for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { pic[i][j] = sc.nextInt(); } } for (int q = 0; q < 4; q++) { for (int i = 0; i < n - m ; i++) { for (int j = 0; j < n - m; j++) { if (search(j, i)) { ans(j + 1, i + 1); continue L; } } } pic = turn(); } System.out.println("NA"); } } }
Main.java:3: error: class A0209 is public, should be declared in a file named A0209.java public class A0209 { ^ 1 error
s661420121
p00209
C++
d
a.cc:1:1: error: 'd' does not name a type 1 | d | ^
s465228661
p00209
C++
chinko
a.cc:1:1: error: 'chinko' does not name a type 1 | chinko | ^~~~~~
s099520569
p00209
C++
#include <iostream> #include <cstdio> using namespace std; int n,m,pic[101][101],ed[51][51]; int edb[101][101]; int site; int num,flag = 0; int ans,count; void deb() { for(int i=0;i<n;i++){ for(int j=0;j<n;j++) cout <<pic[i][j] << " "; cout << endl; } cout << "-------------------"<<endl; for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { printf("%2d ",ed[i][j]); } cout << endl; } cout << "---------------"<<endl; } void input() { for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cin >> pic[i][j]; } } for(int i=0;i<m;i++) { for(int j=0; j<m;j++) { cin >> ed[i][j]; } } } void rot() { // cout << "start rot();" << endl; int rotf = 0; int rotk; for(int i=0;i<m;i++){ rotk = 0; for(int j=m-1;j>=0;j--) { edb[i][rotk] = ed[j][i]; rotk++; } } for(int i=0;i<m;i++) for(int j=0;j<m;j++) { ed[i][j] = edb[i][j]; if(ed[i][j] != -1 && rotf == 0) { site = i*m+j; num = ed[i][j]; rotf = 1; } } // cout << "num = "<<num<<endl; } void check(int h,int w) { int chfla; count = 0; chfla = 0; for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { //printf("ed[%d][%d](%d) == pic[%d][%d](%d)\n",i,j,ed[i][j],h+i-site/m,w+j-site%m,pic[h+i-site/m][w+j-site%m]); if(ed[i][j] == -1)count++; else if(ed[i][j] == pic[h+i-site/m][w+j-site%m]) count++; else { chfla = 1; break; } } if(chfla == 1) break; } ans = (h)*m+(w); // cout << "count = "<<count<<endl; } void search() { int sefla = 0; //cout << num << endl; for(int i=0;i<n;i++) { for(int j=0; j<n;j++) { // printf("pic[%d][%d](%d) == %d\n",i,j,pic[i][j],num); if(pic[i][j] == num) { // printf("pic[%d][%d](%d) => check(%d,%d);\n--------------\n",i,j,pic[i][j] ,i,j); check(i,j); if(count == m*m) { sefla = 1; break; } } } if(sefla == 1) break; } } int main() { while(1) { cin >> n >> m; if(n==0 && m== 0) break; // cout << "start input();" <<endl; input(); // deb(); int maf = 0; for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { // printf("ed[%d][%d] = %d\n",i,j,ed[i][j]); if(ed[i][j] != -1) { site = i*m + j; num = ed[i][j]; maf = 1; break; } } if(maf == 1) break; } // cout << "num = "<<num<<endl; search(); for(int i=0;i<3;i++) { if(count != m*m){ // cout << "start rot();"<<endl; rot(); // deb(); // cout << "srart search();"<<endl; search(); } else break; } if(count == m*m) cout << ans%m+1 << " " << ans/m+1<< endl; else cout << "NA" << endl; } return 0; } }
a.cc:166:1: error: expected declaration before '}' token 166 | } | ^
s450759771
p00209
C++
#include <bits/stdc++.h> using namespace std; void f(int set[][51],int m) { int ans[100][100]={}; for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { ans[j][(m-1)-i]=set[i][j]; } } for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { set[i][j]=ans[i][j]; } } } int main() { int n,m; while(cin >> n >> m && n) { int flag=0; int setcount=0; int count=0; int data[1001][1001]={}; int set[501][501]={}; int i,j,k,l; for(i=0;i<n;i++) for(j=0;j<n;j++) cin >> data[i][j]; for(i=0;i<m;i++) { for(j=0;j<m;j++) { cin >> set[i][j]; if(set[i][j]>=0)setcount++; } } for(int z=0;z<4;z++) { for(int l=0;l<n;l++) { for(int k=0;k<n;k++) { count=0; for(i=0;i<m;i++) { for(j=0;j<m;j++) { if(set[i][j]==data[i+k][j+l])count++; if(count==setcount) { cout << l+i <<" "<< k+j << endl; flag=1; break; } } if(flag)break; } if(flag)break; } if(flag)break; } if(flag)break; else f(set,m); } if(!flag)cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:77:32: error: cannot convert 'int (*)[501]' to 'int (*)[51]' 77 | else f(set,m); | ^~~ | | | int (*)[501] a.cc:5:12: note: initializing argument 1 of 'void f(int (*)[51], int)' 5 | void f(int set[][51],int m) | ~~~~^~~~~~~~~
s056111296
p00209
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<cstdio> #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=1e9; using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; int main(){ int n,m; while(scanf("%d %d",&n,&m),n){ vvi in(n,vi(n)); vvi pic(m,vi(m)); rep(i,n)rep(j,n)scanf("%d",&in[i][j]); rep(i,m)rep(j,m)scanf("%d",&pic[i][j]); pii out(inf,inf); int N=n-m+1,M=n-m+1; rep(e,4){ rep(i,n-m+1)rep(j,n-m+1){ pii t(inf,inf); rep(k,m)rep(l,m) if(pic[k][l]!=-1){ if(in[i+k][j+l]!=pic[k][l])goto en; t=min(t,pii(i+k,j+l)); } out=min(out,t); N=out.first; M=out.second; goto end; en:; if(i==N&&j==M)goto end; } end:; if(i==3)break; vvi tmp=pic; rep(i,m)rep(j,m)pic[i][j]=tmp[j][m-i-1]; } if(out.first==inf)cout<<"NA"<<endl; else cout<<out.second+1<<" "<<out.first+1<<endl; } }
a.cc: In function 'int main()': a.cc:50:28: error: 'i' was not declared in this scope 50 | if(i==3)break; | ^
s052427906
p00209
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for ( int i = 0; i < (int)n; i++ ) #define NMAX 200 #define MMAX 100 #define INFTY (1<<21) int n, m, T[NMAX][NMAX], P[MMAX][MMAX]; void valid(int sx, int sy, int &lx, int &ly) { int ax = -1, ay; rep(y, m) rep(x, m) { if (P[x][y] == -1) continue; if (P[x][y] != T[sx + x][sy + y]) return; if (ax == -1) { ay = y; ax = x; } } if (ay < ly || (ay == ly && ax < lx)) { ly = sy + ay; lx = sx + ax; } } bool rotate(int sx, int sy) { int tmp[MMAX][MMAX]; int ly = INFTY, lx; rep(r, 4) { valid(sx, sy, lx, ly); rep(y, m) rep(x, m) tmp[x][y] = P[x][y]; rep(y, m) rep(x, m) P[y][m - x - 1] = tmp[x][y]; } if (ly == INFTY) return false; cout << lx + 1 << " " << ly + 1 << endl; return true; } void compute() { rep(y, n-m+1) rep(x, n-m+1) if (rotate(x, y)) return; cout << "NA" << endl; } void main() { while (cin >> n >> m && n) { rep(y, n) rep(x, n) cin >> T[x][y]; rep(y, m) rep(x, m) cin >> P[x][y]; compute(); } }
a.cc:52:1: error: '::main' must return 'int' 52 | void main() { | ^~~~
s549733709
p00209
C++
#include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<queue> #include<vector> #include<functional> #include<cmath> #include<map> #include<stack> #include<set> #include<numeric> #include<limits> #include<iterator> #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ll, char> plc; int n, m; int field[110][110]; vector<vector<int> > p; vector<vector<int> > rotate90() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m-j-1][i]; return temp; } vector<vector<int> > l_rotate90() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[j][m-i-1]; return temp; } vector<vector<int> > rotate180() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m-i-1][m-j-1]; return temp; } vector<vector<int> > l_rotate180() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m - i - 1][m - j - 1]; return temp; } vector<vector<int> > rotate270() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[j][m-i-1]; return temp; } vector<vector<int> > l_rotate270() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m-j-1][i]; return temp; } bool check(vector<vector<int> > p_temp) { int x = 0, y = 0; bool flag = false,res = false; for (int i = 0; i < n - m; i++) { for (int j = 0; j < n - m; j++) { flag = false; for (int k = 0; k < m; k++) { for (int l = 0; l < m; l++) { if (p_temp[k][l] == -1)continue; if (field[i + k][j + l] == p_temp[k][l]) { flag = true; } else { if (flag) { flag = false; break; } } } if (!flag)break; } if (flag) { bool f = false; int add_x = 0,add_y = 0; for (int k = 0; k < m; k++) { for (int l = 0; l < m; l++) { if (p_temp[k][l] != -1) { add_x = l, add_y = k; f = true; break; } } if (f)break; } cout << i + 1+add_x << " " << j + 1 + add_y << endl; return 1; } } } return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s036623764
p00209
C++
#include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<queue> #include<vector> #include<functional> #include<cmath> #include<map> #include<stack> #include<set> #include<numeric> #include<limits> #include<iterator> #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ll, char> plc; int n, m; int field[110][110]; vector<vector<int> > p; vector<vector<int> > rotate90() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m-j-1][i]; return temp; } vector<vector<int> > l_rotate90() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[j][m-i-1]; return temp; } vector<vector<int> > rotate180() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m-i-1][m-j-1]; return temp; } vector<vector<int> > l_rotate180() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m - i - 1][m - j - 1]; return temp; } vector<vector<int> > rotate270() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[j][m-i-1]; return temp; } vector<vector<int> > l_rotate270() { vector<vector<int> > temp; temp = p; for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) temp[i][j] = p[m-j-1][i]; return temp; } bool check(vector<vector<int> > p_temp) { int x = 0, y = 0; bool flag = false,res = false; for (int i = 0; i < n - m; i++) { for (int j = 0; j < n - m; j++) { flag = false; for (int k = 0; k < m; k++) { for (int l = 0; l < m; l++) { if (p_temp[k][l] == -1)continue; if (field[i + k][j + l] == p_temp[k][l]) { flag = true; } else { if (flag) { flag = false; break; } } } if (!flag)break; } if (flag) { bool f = false; int add_x = 0,add_y = 0; for (int k = 0; k < m; k++) { for (int l = 0; l < m; l++) { if (p_temp[k][l] != -1) { add_x = l, add_y = k; f = true; break; } } if (f)break; } cout << j + 1 + add_x<<" "<< i + 1 + add_y << endl; return 1; } } } return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s941513031
p00209
C++
#include <cstdio> #include <cstring> #include <numeric> #include <pmmintrin.h> #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) REP(i, 0, n) typedef long long llong; char A[101][128], B[101][128]; __m128i mado[101][16], pic[101][16]; int a[4]; int n, m; int main() { while (scanf("%d%d", &m, &n), (n|m)) { memset(A, 0, sizeof(A)); memset(B, 0, sizeof(B)); int t; rep(i, n) rep(j, n) { scanf("%d", &t); A[i][j] = (t+1) - '0'; } rep(i, m) rep(j, m) { scanf("%d", &t); B[i][j] = (t+1) - '0'; } memcpy(mado, A, sizeof(A)); memcpy(pic, B, sizeof(B)); rep(i, n) { rep(j, n-m+1) { rep(k, m) rep(l, m>>4) { __m128i t = _mm_or_si128(mado[k][l], pic[i+k][l]); t = _mm_xor_si128(t, pic[k][l]); _mm_store_si128((__m128i*)a, t); if (std::accumulate(a, a+4, 0) != 0) goto BREAK; } BREAK: rep(k, m) REP(l, 1, m>>4) mado[i+k][l] = _mm_alignr_epi8(mado[i+k][l], mado[i+k][l-1], 1); } memcpy(mado, A, sizeof(A)); } } return 0; }
a.cc: In function 'int main()': a.cc:35:56: error: '_mm_alignr_epi8' was not declared in this scope; did you mean '_mm_setr_epi8'? 35 | mado[i+k][l] = _mm_alignr_epi8(mado[i+k][l], mado[i+k][l-1], 1); | ^~~~~~~~~~~~~~~ | _mm_setr_epi8
s202742765
p00209
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> #include <iomanip> 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 main() { int n, m; while(cin >> n >> m && n) { vector<vint> view(n, vint(n)), piece(m, vint(m)), buf(m, vint(m)); rep(y, n) rep(x, n) cin >> view[y][x]; rep(y, m) rep(x, m) cin >> piece[y][x]; complex<int> P(-1, -1); rep(i, 4) { rep(y, n - m + 1) rep(x, n - m + 1) { rep(sy, m) rep(sx, m) { if(piece[sy][sx] != -1 && view[y + sy][x + sx] != piece[sy][sx]) goto ng; } rep(sy, m) { rep(sx, m) { if(piece[sy][sx] != -1) { chmin(P, complex<int>(x + sx + 1, y + sy + 1)); goto ng; } } } ng: ; } rep(sy, m / 2) rep(sx, m) swap(piece[sy][sx], piece[m - sy - 1][sx]); REP(sy, 1, m) rep(sx, sy) swap(piece[sy][sx], piece[sx][sy]); } if(P.real() == -1) cout << "NA" << endl; else cout << P.real() << " " << P.imag() << endl; } }
a.cc: In instantiation of 'void chmin(T&, C) [with T = std::complex<int>; C = std::complex<int>]': a.cc:67:13: required from here 67 | chmin(P, complex<int>(x + sx + 1, y + sy + 1)); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:36:56: error: no match for 'operator<' (operand types are 'std::complex<int>' and 'std::complex<int>') 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::pair<_T1, _T2>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::reverse_iterator<_Iterator>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::reverse_iterator<_Iterator>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::move_iterator<_IteratorL>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::move_iterator<_IteratorL>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/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:7: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:36:56: note: mismatched types 'const _CharT*' and 'std::complex<int>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::tuple<_UTypes ...>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ In file included from /usr/include/c++/14/list:65, from a.cc:11: /usr/include/c++/14/bits/stl_list.h:2188:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const __cxx11::list<_Tp, _Alloc>&, const __cxx11::list<_Tp, _Alloc>&)' 2188 | operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_list.h:2188:5: note: template argument deduction/substitution failed: a.cc:36:56: note: 'std::complex<int>' is not derived from 'const std::__cxx11::list<_Tp, _Alloc>' 36 | template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } | ~~^~~ In file included from /usr/include/c++/14/vector:66, from a.cc:12: /usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2089:5: no
s177100531
p00209
C++
#include<iostream> #include<vector> #include<map> #include<algorithm> using namespace std; vector< vector<int> > MakeMatrix(int); multimap<int, int> SpinMatrix(vector< vector<int> >&); void SearchPicture(vector< vector<int> >, vector< vector<int> >, multimap<int, int>, int&, int&); bool SearchPictureInner(vector< vector<int> >, vector< vector<int> >, multimap<int, int>, int, int); int main(){ int i, n, m, x, y; multimap<int, int> info; vector< vector<int> > data1, data2; while(1){ cin >> n >> m; if(n == 0 && m == 0) break; data1 = MakeMatrix(n); data2 = MakeMatrix(m); x = data1.size() - data2.size() + 1; y = 0; for(i=0; i<4; ++i){ info = SpinMatrix(data2); SearchPicture(data1, data2, info, x, y); } if(x == data1.size() - data2.size() + 1) cout << "NA" << endl; else cout << y+1 << " " << x+1 << endl; } return 0; } vector< vector<int> > MakeMatrix(int n){ int i, j, x; vector<int> _data; vector< vector<int> > data; for(i=0; i<n; ++i){ for(j=0; j<n; ++j){ cin >> x; _data.push_back(x); } data.push_back(_data); _data.clear(); } return data; } multimap<int, int> SpinMatrix(vector< vector<int> >& data){ int i, j; vector< vector<int> > _data(data.size(), data.size()); multimap<int, int> map_data; for(i=0; i<data.size(); ++i){ for(j=0; j<data.size(); ++j){ _data[i][j] = data[data.size()-1-j][i]; if(_data[i][j] != -1) map_data.insert(make_pair(i, j)); } } data = _data; return map_data; } void SearchPicture(vector< vector<int> > data1, vector< vector<int> > data2, multimap<int, int> info, int& x, int& y){ int i, j, n; if(x == data1.size() - data2.size() + 1) n = x-1; else n = x; for(i=0; i<=n; ++i){ for(j=0; j<=n; ++j){ if(SearchPictureInner(data1, data2, info, i, j)){ if(i + info.begin()->first < x || (i + info.begin()->first == x && j + info.begin()->second < y)){ x = i + info.begin()->first; y = j + info.begin()->second; } return; } } } } bool SearchPictureInner(vector< vector<int> > data1, vector< vector<int> > data2, multimap<int, int> info, int n, int m){ multimap<int, int>::iterator i; for(i=info.begin(); i!=info.end(); ++i){ if(data1[n + i->first][m + i->second] != data2[i->first][i->second]) return false; } return true; }
a.cc: In function 'std::multimap<int, int> SpinMatrix(std::vector<std::vector<int> >&)': a.cc:58:55: error: no matching function for call to 'std::vector<std::vector<int> >::vector(std::vector<std::vector<int> >::size_type, std::vector<std::vector<int> >::size_type)' 58 | vector< vector<int> > _data(data.size(), data.size()); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /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_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_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 = long unsigned 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<long unsigned 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 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned 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 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned 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 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned 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 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned 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 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned 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
s938028977
p00209
C++
#include<iostream> #include<vector> #include<map> #include<algorithm> using namespace std; vector< vector<int> > MakeMatrix(int); multimap<int, int> SpinMatrix(vector< vector<int> >&); void SearchPicture(vector< vector<int> >, vector< vector<int> >, multimap<int, int>, int&, int&); bool SearchPictureInner(vector< vector<int> >, vector< vector<int> >, multimap<int, int>, int, int); int main(){ int i, n, m, x, y; multimap<int, int> info; vector< vector<int> > data1, data2; while(1){ cin >> n >> m; if(n == 0 && m == 0) break; data1 = MakeMatrix(n); data2 = MakeMatrix(m); x = data1.size() - data2.size() + 1; y = 0; for(i=0; i<4; ++i){ info = SpinMatrix(data2); SearchPicture(data1, data2, info, x, y); } if(x == data1.size() - data2.size() + 1) cout << "NA" << endl; else cout << y+1 << " " << x+1 << endl; } return 0; } vector< vector<int> > MakeMatrix(int n){ int i, j, x; vector<int> _data; vector< vector<int> > data; for(i=0; i<n; ++i){ for(j=0; j<n; ++j){ cin >> x; _data.push_back(x); } data.push_back(_data); _data.clear(); } return data; } multimap<int, int> SpinMatrix(vector< vector<int> >& data){ int i, j; int n = data.size(); vector< vector<int> > _data(n, n); multimap<int, int> map_data; for(i=0; i<n; ++i){ for(j=0; j<n; ++j){ _data[i][j] = data[n-1-j][i]; if(_data[i][j] != -1) map_data.insert(make_pair(i, j)); } } data = _data; return map_data; } void SearchPicture(vector< vector<int> > data1, vector< vector<int> > data2, multimap<int, int> info, int& x, int& y){ int i, j, n; if(x == data1.size() - data2.size() + 1) n = x-1; else n = x; for(i=0; i<=n; ++i){ for(j=0; j<=n; ++j){ if(SearchPictureInner(data1, data2, info, i, j)){ if(i + info.begin()->first < x || (i + info.begin()->first == x && j + info.begin()->second < y)){ x = i + info.begin()->first; y = j + info.begin()->second; } return; } } } } bool SearchPictureInner(vector< vector<int> > data1, vector< vector<int> > data2, multimap<int, int> info, int n, int m){ multimap<int, int>::iterator i; for(i=info.begin(); i!=info.end(); ++i){ if(data1[n + i->first][m + i->second] != data2[i->first][i->second]) return false; } return true; }
a.cc: In function 'std::multimap<int, int> SpinMatrix(std::vector<std::vector<int> >&)': a.cc:59:35: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int&)' 59 | vector< vector<int> > _data(n, n); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /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_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_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
s851715667
p00209
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int n,m; int rx,ry; int px,py; int pic[101][101]; int pic2[101][101]; int p[101][101]; bool check(int x,int y){ for(int i=0;i<m;i++){ for(int j=0;j<m;j++){ if(p[j][i]!=-1 && p[j][i]!=pic[x+j][y+i])return false; } } return true; } void pc(){ for(int i=0;i<m;i++){ for(int j=0;j<m;j++){ if(p[j][i]!=-1){ px=j; py=i; return; }; } } } void dfs(){ for(int i=0;i<n-m;i++){ for(int j=0;j<n-m;j++){ if(check(j,i) && (i+py<ry || i+py==ry && j+px<rx)){ rx=j+px; ry=i+py; break; } } } } void turn(){ for(int i=0;i<m;i++){ for(int j=0;j<m;j++)pic2[m-1-i][j]=p[j][i]; } for(int i=0;i<m;i++){ for(int j=0;j<m;j++){ p[j][i]=pic2[j][i]; //printf("%d ",pic[j][i]); } //printf("\n"); } } int main(void){ while(1){ scanf("%d%d",&n,&m); memset(pic,0,sizeof(pic)); memset(pic2,0,sizeof(pic2)); memset(p,0,sizeof(p)); if(n==0 && m==0)break; for(int i=0;i<n;i++){ for(int j=0;j<n;j++)scanf("%d",&pic[j][i]); } for(int i=0;i<m;i++){ for(int j=0;j<m;j++)scanf("%d",&p[j][i]); } rx=n,ry=n; for(int i=0;i<=4;i++){ pc(); dfs(); turn(); } if(rx==n && ry==n)printf("NA\n"); else printf("%d %d\n",rx+1,ry+1); } return 0; }
a.cc: In function 'int main()': a.cc:63:17: error: 'memset' was not declared in this scope 63 | memset(pic,0,sizeof(pic)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 |
s494780882
p00209
C++
#include <iostream> using namespace std; const int max_matrix_size = 100; void p(int a[max_matrix_size][max_matrix_size], int size, int offseti = 0, int offsetj = 0){ for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ cout << a[offseti+i][offsetj+j] << ' '; } cout << endl; } } // aの[starti][startj]からsize分の正方行列を比較 bool compareMatrix(int a[max_matrix_size][max_matrix_size], int b[max_matrix_size][max_matrix_size], int starti, int startj, int size){ for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ if( b[i][j] == -1) continue; if(a[starti+i][startj+j] != b[i][j]) return false; } } p(a, size, starti, startj); p(b, size); return true; } // 2次元配列を90度回転 void rotateMatrix(int (*a)[max_matrix_size], int size){ int tmp[max_matrix_size][max_matrix_size]; for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ tmp[i][j] = a[j][(size-1)-i]; } } memcpy(a, tmp, sizeof(int)*max_matrix_size*max_matrix_size); } void printnonnegative(int piece[max_matrix_size][max_matrix_size], int size, int offseti, int offsetj){ for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ if(piece[i][j] != -1){ cout << offsetj+j+1 << ' ' << offseti+i+1 << endl; return; } } } } void search(int pict[max_matrix_size][max_matrix_size], int pictsize, int piece[max_matrix_size][max_matrix_size], int piecesize ){ for(int i = 0; i < pictsize - piecesize + 1; i++){ for(int j = 0; j < pictsize - piecesize + 1; j++){ //cout << "i = " << i << ", j = " << j << endl; for(int k = 0; k < 4; k++){ //cout << "rotate:" << k*90 << endl; if(compareMatrix(pict, piece, i, j, piecesize) == true){ printnonnegative(piece, piecesize, i, j); return; } rotateMatrix(piece, piecesize); } } } cout << "NA" << endl; } int main(){ int picture[max_matrix_size][max_matrix_size]; int piece[max_matrix_size][max_matrix_size]; int n, m; while(cin >> n >> m){ if(!n && !m) break; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ cin >> picture[i][j]; } } for(int i = 0; i < m; i++){ for(int j = 0; j < m; j++){ cin >> piece[i][j]; } } search(picture, n, piece, m); } return 0; }
a.cc: In function 'void rotateMatrix(int (*)[100], int)': a.cc:38:9: error: 'memcpy' was not declared in this scope 38 | memcpy(a, tmp, sizeof(int)*max_matrix_size*max_matrix_size); | ^~~~~~ a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 |
s610146228
p00210
C
#include <stdio.h> #define CWALL '#' #define CFLOOR '.' #define CEXIT 'X' #define CEAST 'E' #define CNORTH 'N' #define CWEST 'W' #define CSOUTH 'S' enum direction { EAST = 0, NORTH, WEST, SOUTH }; typedef struct { int real; int imag; } complex_t; void complex_mul(const complex_t *s1, const complex_t *s2, complex_t *t) { t->real = s1->real * s2->real - s1->imag * s2->imag; t->imag = s1->real * s2->imag + s1->imag * s2->real; } void complex_mul_dest(complex_t *t, const complex_t *m) { int r = t->real, i = t->imag; t->real = r * m->real - i * m->imag; t->imag = r * m->imag + i * m->real; } const complex_t east = {1, 0}; const complex_t north = {0, -1}; const complex_t west = {-1, 0}; const complex_t south = {0, 1}; const complex_t front = east; const complex_t back = west; const complex_t left = north; const complex_t right = south; const complex_t look_dir[] = {right, front, left, back}; const char dir_char[] = {CEAST, CNORTH, CWEST, CSOUTH}; typedef struct { char c; complex_t direction; int x; int y; int in_maze; } player_t; void print_table(char t[][31], int w, int h) { int i, j; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { printf("%c", t[i][j]); } printf("\n"); } printf("\n"); } int main(void) { int W, H, i, j, pid, pcount, s; char maze[30][31], cell; player_t player[800], *p; while (scanf("%d%d\n", &W, &H) == 2 && W && H) { pid = 0; for (i = 0; i < H; i++) { scanf("%s", maze[i]); for (j = 0; j < W; j++) { cell = maze[i][j]; if (cell == CEAST || cell == CNORTH || cell == CWEST || cell == CSOUTH) { p = &player[pid++]; p->c = cell; p->x = j; p->y = i; p->in_maze = 1; switch (cell) { case CEAST: p->direction = east; break; case CNORTH: p->direction = north; break; case CWEST: p->direction = west; break; case CSOUTH: p->direction = south; break; default: break; } } } } pcount = pid; for (s = 0; s < 180; s++) { player_t *move_queue[4][200]; complex_t dir; enum direction pdir; int qidx[4] = {}; char *acell; // print_table(maze, W, H); // look around for (i = 0; i < pid; i++) { p = &player[i]; if (!p->in_maze) continue; for (j = 0; j < 4; j++) { complex_mul(&(p->direction), &(look_dir[j]), &dir); acell = &maze[p->y + dir.imag][p->x + dir.real]; if (*acell == CFLOOR || *acell == CEXIT) { p->direction = dir; pdir = (direction)((dir.imag==-1)*1 + (dir.real==-1)*2 + (dir.imag==1)*3); move_queue[(pdir+2)%4][qidx[(pdir+2)%4]++] = p; maze[p->y][p->x] = dir_char[pdir]; break; } } } // move for (i = 0; i < 4; i++) { for (j = 0; j < qidx[i]; j++) { p = move_queue[i][j]; acell = &maze[p->y + p->direction.imag][p->x + p->direction.real]; if (*acell == CFLOOR) { *acell = maze[p->y][p->x]; maze[p->y][p->x] = CFLOOR; p->x += p->direction.real; p->y += p->direction.imag; } else if (*acell == CEXIT) { maze[p->y][p->x] = CFLOOR; p->in_maze = 0; pcount--; } } } if (pcount == 0) break; } if (s == 180) { printf("NA\n"); } else { printf("%d\n", s + 1); } } return 0; }
main.c: In function 'main': main.c:113:33: error: 'direction' undeclared (first use in this function) 113 | pdir = (direction)((dir.imag==-1)*1 + (dir.real==-1)*2 + (dir.imag==1)*3); | ^~~~~~~~~ main.c:113:33: note: each undeclared identifier is reported only once for each function it appears in
s612787213
p00210
C
#include <stdio.h> #define CWALL '#' #define CFLOOR '.' #define CEXIT 'X' #define CEAST 'E' #define CNORTH 'N' #define CWEST 'W' #define CSOUTH 'S' enum direction { EAST = 0, NORTH, WEST, SOUTH }; typedef struct { int real; int imag; } complex_t; void complex_mul(const complex_t *s1, const complex_t *s2, complex_t *t) { t->real = s1->real * s2->real - s1->imag * s2->imag; t->imag = s1->real * s2->imag + s1->imag * s2->real; } void complex_mul_dest(complex_t *t, const complex_t *m) { int r = t->real, i = t->imag; t->real = r * m->real - i * m->imag; t->imag = r * m->imag + i * m->real; } const complex_t east = {1, 0}; const complex_t north = {0, -1}; const complex_t west = {-1, 0}; const complex_t south = {0, 1}; complex_t front = east; complex_t back = west; complex_t left = north; complex_t right = south; complex_t look_dir[] = {right, front, left, back}; const char dir_char[] = {CEAST, CNORTH, CWEST, CSOUTH}; typedef struct { char c; complex_t direction; int x; int y; int in_maze; } player_t; void print_table(char t[][31], int w, int h) { int i, j; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { printf("%c", t[i][j]); } printf("\n"); } printf("\n"); } int main(void) { int W, H, i, j, pid, pcount, s; char maze[30][31], cell; player_t player[800], *p; while (scanf("%d%d\n", &W, &H) == 2 && W && H) { pid = 0; for (i = 0; i < H; i++) { scanf("%s", maze[i]); for (j = 0; j < W; j++) { cell = maze[i][j]; if (cell == CEAST || cell == CNORTH || cell == CWEST || cell == CSOUTH) { p = &player[pid++]; p->c = cell; p->x = j; p->y = i; p->in_maze = 1; switch (cell) { case CEAST: p->direction = east; break; case CNORTH: p->direction = north; break; case CWEST: p->direction = west; break; case CSOUTH: p->direction = south; break; default: break; } } } } pcount = pid; for (s = 0; s < 180; s++) { player_t *move_queue[4][200]; complex_t dir; enum direction pdir; int qidx[4] = {}; char *acell; // print_table(maze, W, H); // look around for (i = 0; i < pid; i++) { p = &player[i]; if (!p->in_maze) continue; for (j = 0; j < 4; j++) { complex_mul(&(p->direction), &(look_dir[j]), &dir); acell = &maze[p->y + dir.imag][p->x + dir.real]; if (*acell == CFLOOR || *acell == CEXIT) { p->direction = dir; pdir = (direction)((dir.imag==-1)*1 + (dir.real==-1)*2 + (dir.imag==1)*3); move_queue[(pdir+2)%4][qidx[(pdir+2)%4]++] = p; maze[p->y][p->x] = dir_char[pdir]; break; } } } // move for (i = 0; i < 4; i++) { for (j = 0; j < qidx[i]; j++) { p = move_queue[i][j]; acell = &maze[p->y + p->direction.imag][p->x + p->direction.real]; if (*acell == CFLOOR) { *acell = maze[p->y][p->x]; maze[p->y][p->x] = CFLOOR; p->x += p->direction.real; p->y += p->direction.imag; } else if (*acell == CEXIT) { maze[p->y][p->x] = CFLOOR; p->in_maze = 0; pcount--; } } } if (pcount == 0) break; } if (s == 180) { printf("NA\n"); } else { printf("%d\n", s + 1); } } return 0; }
main.c:44:25: error: initializer element is not constant 44 | complex_t look_dir[] = {right, front, left, back}; | ^~~~~ main.c:44:25: note: (near initialization for 'look_dir[0]') main.c:44:32: error: initializer element is not constant 44 | complex_t look_dir[] = {right, front, left, back}; | ^~~~~ main.c:44:32: note: (near initialization for 'look_dir[1]') main.c:44:39: error: initializer element is not constant 44 | complex_t look_dir[] = {right, front, left, back}; | ^~~~ main.c:44:39: note: (near initialization for 'look_dir[2]') main.c:44:45: error: initializer element is not constant 44 | complex_t look_dir[] = {right, front, left, back}; | ^~~~ main.c:44:45: note: (near initialization for 'look_dir[3]') main.c: In function 'main': main.c:113:33: error: 'direction' undeclared (first use in this function) 113 | pdir = (direction)((dir.imag==-1)*1 + (dir.real==-1)*2 + (dir.imag==1)*3); | ^~~~~~~~~ main.c:113:33: note: each undeclared identifier is reported only once for each function it appears in
s267688947
p00210
C++
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--) #define REP(i,n) for(int i=0;i<(n);i++) #define RREP(i,n) for(int i=n-1;i>=0;i--) #define PB push_back #define INF (1<<29) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define CLR(a) memset(a,0,sizeof(a)) #define fr first #define sc second typedef long long int ll; const int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1}; const int ddir[] = {3,0,1,2}; const char dir[] = {'W','S','E','N'}; using namespace std; struct person{ int dir; int x; int y; }; void Sort(vector< struct person> &p){ vector< pair< int,pair<int,int> > > ret; REP(i,p.size()){ ret.PB(pair<int,pair<int,int> >(p[i].dir,pair<int,int>(p[i].x,p[i].y))); } sort(RALL(ret)); REP(i,p.size()){ p[i].dir = ret[i].fr; p[i].x = ret[i].sc.fr; p[i].y = ret[i].sc.sc; } } int main(){ while(true){ int w,h; cin >> w >> h; if(w == 0 && h == 0) break; vector< vector<char> > board(h,vector<char>(w)); vector< struct person > people; REP(i,h)REP(j,w){ cin >> board[i][j]; bool flg = false; REP(k,4){ if(dir[k] == board[i][j]) flg = true; } if(flg){ struct person p; p.x = j; p.y = i; REP(k,4){ if(board[i][j] == dir[k]){ p.dir = k; break; } } people.PB(p); } } int ans = -1; REP(a,181){ if(people.size() == 0){ ans = a; break; } vector< vector<char> > board1 = board; REP(i,people.size()){ int x = people[i].x; int y = people[i].y; board1[y][x] = '.'; /* cout << "board1[y][x] = "<< board1[y][x] << endl; REP(i,h){ REP(j,w){ cout << board1[i][j]; } cout << endl; } cout << "board[y][x] = "<< board[y][x] << endl; REP(i,h){ REP(j,w){ cout << board[i][j]; } cout << endl; } */ } REP(i,h)REP(j,w){ if(board1[i][j] == 'X') board1[i][j] = 'x'; } RREP(i,people.size()){ REP(k,4){ int nk = (ddir[k]+people[i].dir)%4; int nx = people[i].x + dx[nk]; int ny = people[i].y + dy[nk]; if(nx<0||w<=nx||ny<0||h<=ny) continue; if(board[ny][nx] != '#'){ /* cout << "===BEGIN===" << endl; printf("people.x = %d , people.y = %d\n",people[i].x,people[i].y); printf("board[%d][%d] = %c\n",ny,nx,board[ny][nx]); printf("nx = %d ny = %d\n",nx,ny); printf("dir = %d\n",people[i].dir); printf("nk = %d dx = %d dy = %d\n",nk,dx[nk],dy[nk]); cout << "===END===" << endl; */ bool leftflg = false; REP(j,4){ if(board[ny][nx] == dir[j]) leftflg =true; } if(leftflg) { continue; } people[i].dir = nk; break; } } } //sort(RALL(people)); Sort(people); RREP(i,people.size()){ int nk = people[i].dir; int nx = people[i].x + dx[nk]; int ny = people[i].y + dy[nk]; //printf("nx = %d ny = %d\n",nx,ny); if(board1[ny][nx] != '.'){ if(board1[ny][nx] == 'x'){ board1[ny][nx] = 'X'; people.erase(people.begin()+i); continue; } nx = people[i].x; ny = people[i].y; } people[i].x = nx; people[i].y = ny; board1[ny][nx] = dir[people[i].dir]; } board = board1; /* cout << "board1==== "<<endl; REP(i,h){ REP(j,w){ cout << board[i][j]; } cout << endl; } */ } if(a >= 0) cout << a << endl; else cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:159:12: error: 'a' was not declared in this scope 159 | if(a >= 0) cout << a << endl; | ^
s854615179
p00210
C++
#include<iostream> #include<algorithm> using namespace std; struct State{char x[35][35];}; int H,W,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};State S;char f[5]="NESW"; int solve(State V,int depth){ if(depth==31)return 99999999; bool OK=true; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(V.x[i][j]>='A' && V.x[i][j]<='W')OK=false; } } if(OK==true)return depth; vector<int>G[30][30]; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(V.x[i][j]<'A' || V.x[i][j]>'W')continue; int dr=0;for(int k=0;k<4;k++){if(V.x[i][j]==f[k])dr=k;} for(int k=dr+5;k>=dr-2;k--){ int ex=i+dx[k%4],ey=j+dy[k%4]; if(V.x[ex][ey]=='X' || V.x[ex][ey]=='.'){ V.x[i][j]=f[k%4]; G[ex][ey].push_back((11-k)%4);break; } } } } State I=V; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(G[i][j].size()>=1){ sort(G[i][j].begin(),G[i][j].end()); int J=(11-G[i][j][0])%4; int fx=i-dx[J],fy=j-dy[J]; if(I.x[i][j]!='X'){I.x[i][j]=I.x[fx][fy];} I.x[fx][fy]='.'; } } } return solve(I,depth+1); } int main(){ while(true){ cin>>W>>H;if(W==0 && H==0)break; for(int i=0;i<H;i++){for(int j=0;j<W;j++)cin>>S.x[i][j];} int ans=solve(S,0); if(ans>180)cout<<"NA"<<endl;else cout<<ans<<endl; } return 0; }
a.cc: In function 'int solve(State, int)': a.cc:15:9: error: 'vector' was not declared in this scope 15 | vector<int>G[30][30]; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include<algorithm> +++ |+#include <vector> 3 | using namespace std; a.cc:15:16: error: expected primary-expression before 'int' 15 | vector<int>G[30][30]; | ^~~ a.cc:25:41: error: 'G' was not declared in this scope 25 | G[ex][ey].push_back((11-k)%4);break; | ^ a.cc:33:28: error: 'G' was not declared in this scope 33 | if(G[i][j].size()>=1){ | ^
s315695198
p00210
C++
#include <iostream> #include <string> using namespace std; int dx[]={1,0,-1,0}; int dy[]={0,-1,0,1}; int main() { int W,H; while(cin >> W >> H, (W||H)) { int cnt=0, p[35][35],tp[35][35]; char f[35][35]; cin.ignore(); for(int i=0; i<H; i++) { string t; getline(cin, t); for(int j=0; j<W; j++) { f[j][i]=t[j]; p[j][i]=-1; if(f[j][i]=='E') p[j][i]=0; if(f[j][i]=='S') p[j][i]=3; if(f[j][i]=='W') p[j][i]=2; if(f[j][i]=='N') p[j][i]=1; if(p[j][i]!=-1) cnt++; } } int ret=0; for(; ret<=180; ret++) { if(cnt==0) break; for(int i=0; i<H; i++) for(int j=0; j<W; j++) { tp[j][i]=-1; if(p[j][i]!=-1) { int next=p[j][i]; for(int k=0; k<4; k++) { int d=(p[j][i]+k+3)%4; int tx=j+dx[d], ty=i+dy[d]; if(tx<0||ty<0||tx>=W||ty>=H) continue; if(f[tx][ty]=='#'||p[tx][ty]!=-1) continue; next=d; break; } p[j][i]=next; } } for(int i=0; i<H; i++) for(int j=W-1; j>=0; j--) { if(p[j][i]!=-1) { int tx=j+dx[p[j][i]], ty=i+dy[p[j][i]]; if(tp[tx][ty]==-1&&p[tx][ty]==-1) tp[tx][ty]=p[j][i]; else tp[j][i]=p[j][i]; } } memcpy(p, tp, sizeof(p)); for(int i=0; i<H; i++) for(int j=0; j<W; j++) { if(f[j][i]=='X'&&p[j][i]!=-1) { cnt--; p[j][i]=-1; } } } if(ret>180) cout <<"NA"<< endl; else cout << ret << endl; } }
a.cc: In function 'int main()': a.cc:72:25: error: 'memcpy' was not declared in this scope 72 | memcpy(p, tp, sizeof(p)); | ^~~~~~ a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #include <string>
s350920527
p00211
Java
import java.math.*; import java.util.*; public class a0211{ public static void main(String[] args){ int i; Scanner sc=new Scanner(System.in); int n; while(true){ n=sc.nextInt(); if(n==0) break; int[] a=new int[n]; int[] b=new int[n]; for(i=0;i<n;++i){ a[i]=sc.nextInt(); b[i]=sc.nextInt(); } BigInteger c=new BigInteger(Integer.toString(b[0])); for(i=1;i<n;++i) c=c.divide(c.gcd(new BigInteger(Integer.toString(b[i])))).multiply(new BigInteger(Integer.toString(b[i]))); BigInteger[] d=new BigInteger[n]; for(i=0;i<n;++i) d[i]=c.divide(new BigInteger(Integer.toString(b[i]))).multiply(new BigInteger(Integer.toString(a[i]))); BigInteger e=new BigInteger("1"); for(i=0;i<n;++i) e=e.divide(e.gcd(d[i])).multiply(d[i]); for(i=0;i<n;++i){ System.out.println(new BigInteger(Integer.toString(b[i])).multiply(e).divide(new BigInteger(Integer.toString(a[i]))).divide(c)); } } } }
Main.java:3: error: class a0211 is public, should be declared in a file named a0211.java public class a0211{ ^ 1 error
s114687229
p00211
C++
#include<iostream> using namespace std; int gcd(int a,int b){ return a%b==0 ? b : gcd(b,a%b);} int main(){ while(true){ long long int p = 1; int d[11]; int v[11]; int n; cin >> n; for(int i=0;i<n;i++){ cin >> d[i] >> v[i]; p *= d[i] / gcd(d[i],v[i]); } for(int i=0;i<n;i++){ cout << v[i]*p/d[i]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s261581978
p00211
C++
#include<iostream> #include<algorithm> #include<vector> #define PB push_back using namespace std; int gcd(int a,int b){ return a%b==0 ? b : gcd(b,a%b);} vector<long long int> lcm(vector<long long int> v){ vector<long long int> ret; for(int i=0;i<v.size()-1;i++){ ret.PB(v[i]*v[i+1]/gcd(v[i],v[i+1])); } return ret; } int main(){ while(true){ long long int p = 1; long long int d[11]; long long int v[11]; vector<long long int> lc; int n; cin >> n; if(!n) break; for(int i=0;i<n;i++){ cin >> d[i] >> v[i]; lc.PB(d[i]/gcd(d[i],v[i])); } while(lc.size()>1){ lc = lcm(lc); } p = lc[0]; bool flg = true; for(int i=0;i<n;i++){ if(p % d[i] == 0){ flg = false; break; } } vector<long long int> ans; bool flg = true; for(int i=0;i<n;i++){ ans.PB(v[i]*p/d[i]); } for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(ans[i]!=ans[j]) flg = false; } } if(flg){ for(int i=0;i<n;i++){ cout << ans[i] << endl; } }else{ for(int i=0;i<n;i++){ cout << 1 << endl; } } } return 0; }
a.cc: In function 'int main()': a.cc:42:14: error: redeclaration of 'bool flg' 42 | bool flg = true; | ^~~ a.cc:33:14: note: 'bool flg' previously declared here 33 | bool flg = true; | ^~~
s878713730
p00211
C++
#include<iostream> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; typedef long long ll; ll lcm(ll a,ll b){return a/__gcd(a,b)*b;} int main(){ int n,d[10],v[10],t; while(cin>>n,n){ rep(i,n)cin>>d[i]>>v[i],t=__gcd(d[i],v[i]),d[i]/=t,v[i]/=t; ll a=d[0],b=v[0]; rep(i,n)a=lcm(a,d[i]),b=__gcd(b,(ll)v[i]); rep(i,n)cout<<a/b*v[i]/d[i]<<endl; } return 0; }
a.cc: In function 'll lcm(ll, ll)': a.cc:5:28: error: '__gcd' was not declared in this scope 5 | ll lcm(ll a,ll b){return a/__gcd(a,b)*b;} | ^~~~~ a.cc: In function 'int main()': a.cc:9:43: error: '__gcd' was not declared in this scope 9 | rep(i,n)cin>>d[i]>>v[i],t=__gcd(d[i],v[i]),d[i]/=t,v[i]/=t; | ^~~~~ a.cc:11:41: error: '__gcd' was not declared in this scope 11 | rep(i,n)a=lcm(a,d[i]),b=__gcd(b,(ll)v[i]); | ^~~~~
s087459006
p00211
C++
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} template<class T> inline T sqr(T x) {return x*x;} typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define exist(s,e) ((s).find(e)!=(s).end()) #define range(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) range(i,0,n) #define clr(a,b) memset((a), (b) ,sizeof(a)) #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; const double eps = 1e-10; const double pi = acos(-1.0); const ll inf =1LL << 62; ll gcd (ll a,ll b){ if(b==0) return a; return gcd (b,a%b); } ll lcm(ll a,ll b){ return a/gcd(a,b)*b; } int main(void){ int n; ll runner[10][2]; ll change[10]; while(cin >> n,n){ rep(i,n) cin >> runner[i][0] >> runner[i][1]; rep(i,n) { ll tmp=gcd(runnner[i][0],runnner[i][1]); runnner[i][0]/=tmp; runnner[i][1]/=tmp; } ll l=runner[0][1]; rep(i,n-1) l=lcm(l,runner[i+1][1]); rep(i,n) change[i]=l/runner[i][1]*runner[i][0]; l=change[0]; rep(i,n-1) l=lcm(l,change[i+1]); rep(i,n) cout << l/change[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:67:36: error: 'runnner' was not declared in this scope; did you mean 'runner'? 67 | ll tmp=gcd(runnner[i][0],runnner[i][1]); | ^~~~~~~ | runner
s746418015
p00211
C++
import java.util.*; import java.io.*; import java.math.BigInteger; 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; BigInteger[] d = new BigInteger[n], v = new BigInteger[n]; d[0] = new BigInteger(sc.next()); v[0] = new BigInteger(sc.next()); BigInteger div = gcd(d[0], v[0]); d[0] = d[0].divide(div); v[0] = v[0].divide(div); BigInteger nume = new BigInteger("" + d[0]), deno = new BigInteger("" + v[0]); for(int i=1;i<n;i++) { d[i] = new BigInteger(sc.next()); v[i] = new BigInteger(sc.next()); div = gcd(d[i], v[i]); d[i] = d[i].divide(div); v[i] = v[i].divide(div); nume = lcm(nume, d[i]); deno = gcd(deno, v[i]); } for(int i=0;i<n;i++) { System.out.println(nume.divide(d[i]).multiply(v[i]).divide(deno) ); } } } BigInteger lcm(BigInteger x, BigInteger y) { return x.divide(gcd(x, y)).multiply(y); } BigInteger gcd(BigInteger x, BigInteger y) { if(y.equals(new BigInteger("0"))) return x; return gcd(y, x.divideAndRemainder(y)[1]); } 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 java.math.BigInteger; | ^~~~~~ a.cc:4: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.util.Arrays.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import static java.util.Collections.*; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: 'import' does not name a type 8 | import static java.lang.Math.*; | ^~~~~~ a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:10:1: error: expected unqualified-id before 'public' 10 | public class Main { | ^~~~~~
s875037278
p00212
C
#include <cstdio> #include <cstdlib> #include <queue> #include <vector> #include <utility> #include <functional> using namespace std; #define INF 19980725 /** 割引券の枚数 */ static int c; #define C 10 /** 町の数 */ static int n; #define N 100 /** 路線数 */ static int m; #define M 500 /** 出発地 */ static int s; /** 目的地 */ static int d; /** 路線情報 */ static int map[ N ][ N ]; /** 各探索先における状態 */ struct stat { /** 到達先の町 */ int pos; /** 現時点までの費用 */ int cost; /** 割引券の残枚数 */ int rem; stat ( ) { this->cost = INF; this->rem = 0; } stat ( int pos, int cost, int rem ) { this->pos = pos; this->cost = cost; this->rem = rem; } bool operator> ( const stat &a ) const { return ( cost > a.cost || ( cost == a.cost && rem < a.rem ) ); } }; int main ( int argc, char *argv[ ] ) { for ( ; ; ) { /** 探索キュー */ priority_queue<stat, vector<stat>, greater<stat> > lis; /** s->k への最小費用res[ k ] */ int res[ N ]; int i, j; /* 基本情報読み込み */ scanf ( "%d%d%d%d%d", &c, &n, &m, &s, &d ); if ( !( c | n | m | s | d ) ) break ; --s; --d; /* 路線情報初期化 */ for ( i = 0; i < n; ++i ) for ( j = 0; j < n; ++j ) map[ i ][ j ] = INF; /* 路線情報読み込み */ for ( i = 0; i < m; ++i ) { int a, b, f; scanf ( "%d%d%d", &a, &b, &f ); --a; --b; map[ a ][ b ] = map[ b ][ a ] = f; } /* s->d に対してダイクストラ法を適用 */ fill ( res, res + n, INF ); lis.push ( stat ( s, 0, c ) ); while ( !lis.empty ( ) ) { const stat st = lis.top ( ); lis.pop ( ); /* 結果が既に求まっていれば処理しない */ if ( res[ st.pos ] != INF ) continue ; res[ st.pos ] = st.cost; for ( i = 0; i < n; ++i ) { /* st.pos からi への経路が存在しなければ処理しない */ if ( map[ st.pos ][ i ] == INF ) continue ; /* 隣接する町の探索を予約する.割引券が使えればその探索も予約する. */ lis.push ( stat ( i, st.cost + map[ st.pos ][ i ], st.rem ) ); if ( st.rem > 0 ) lis.push ( stat ( i, st.cost + map[ st.pos ][ i ] / 2, st.rem - 1 ) ); } } printf ( "%d\n", res[ d ] ); } return ( EXIT_SUCCESS ); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s393293464
p00212
C
#include<stdio.h> #include<string.h> #include<utility> #include<queue> #include<algorithm> using namespace std; #define INF 100000000 int C,N,M,S,D,g1[101][101],g2[101][101],s,t,c,d[101],u[101]; typedef struct P{int p,c,t;}P; struct Order { bool operator ()(P const& a, P const& b) const { return a.c==b.c?a.t<b.t:a.c>b.c; } }; P tmp,tmp2; priority_queue<P,vector<P>,Order>Q; int main() { for(;scanf("%d%d%d%d%d",&C,&N,&M,&S,&D),C;) { for(int i=0;i<=N;i++) { d[i]=INF; for(int j=0;j<=N;j++) g1[i][j]=g2[i][j]=INF; } for(int i=0;i<N;i++) { scanf("%d%d%d",&s,&t,&c); g1[s][t]=g1[t][s]=c; g2[s][t]=g2[t][s]=c/2; } d[S]=0; tmp.c=0;tmp.p=S;tmp.t=C; Q.push(tmp); for(;!Q.empty();) { tmp=Q.top(),Q.pop(); for(int i=1;i<=N;i++) { int nc=d[tmp.p]+g1[tmp.p][i]; if((d[i]==nc&&u[i]>tmp.p)||d[i]>nc) { tmp2.c=d[i]=d[tmp.p]+g1[tmp.p][i]; tmp2.p=i; tmp2.t=tmp.t; Q.push(tmp2); } nc=d[tmp.p]+g2[tmp.p][i]; if(tmp.t>0&&((d[i]==nc&&u[i]>tmp.p-1)||d[i]>nc)) { tmp2.c=d[i]=d[tmp.p]+g2[tmp.p][i]; tmp2.p=i; tmp2.t=tmp.t-1; Q.push(tmp2); } } } printf("%d\n",d[D]); } }
main.c:3:9: fatal error: utility: No such file or directory 3 | #include<utility> | ^~~~~~~~~ compilation terminated.
s764482891
p00212
C++
#include <iostream> #include <queue> #include <algorithm> #define MAX 1000000000 #define Debug(X) debug( __LINE__, X ) template<class T> void debug( int line, T dbg ){ std::cout << line << ": " << dbg << std::endl; } class State{ public: int p, s, c; State():p(0), s(0), c(0){} State(int P, int S, int C):p(P), s(S), c(C){} bool operator < (const State &s) const{ return c > s.c; } }; int c, n, m, s, d; int route[101][101]; std::priority_queue<State> que; bool used[101]; int main(){ while( std::cin >> c >> n >> m >> s >> d, c * n * m * s * d ){ for( int i = 0; i < 101 * 101; ++i ) route[i / 101][i % 101] = MAX; memset( used, 0, sizeof( used ) ); que = std::priority_queue<State>(); int tmp[3]; while( m-- ){ int cnt = 3; while( cnt-- ) std::cin >> tmp[2 - cnt]; route[tmp[0]][tmp[1]] = tmp[2]; route[tmp[1]][tmp[0]] = tmp[2]; } que.push(State( c, s, 0 )); while( true ){ State data = que.top(); que.pop(); if( used[data.s] )continue; used[data.s] = 1; if( data.s == d ){ std::cout << data.c << std::endl; break; } for( int i = 1; i <= n; ++i ){ if( i == data.s || route[data.s][i] == MAX )continue; if( data.p > 0 ) que.push( State( data.p - 1, i, data.c + route[data.s][i] / 2 ) ); que.push( State( data.p, i, data.c + route[data.s][i] ) ); } } } }
a.cc: In function 'int main()': a.cc:33:17: error: 'memset' was not declared in this scope 33 | memset( used, 0, sizeof( used ) ); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 |
s962708879
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> #include<math.h> struct crq{ int cost; int ticket; int now; bool operator >(const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; priority_queue<crq,vector<crq>,greater<crq>> q; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; unsigned int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=INT_MAX; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:21: error: 'INT_MAX' was not declared in this scope 34 | ans=INT_MAX; | ^~~~~~~ a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 5 | #include<math.h> +++ |+#include <climits> 6 | struct crq{
s601666400
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> #include<math.h> struct crq{ int cost; int ticket; int now; bool operator >(const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; priority_queue<crq,vector<crq>,greater<crq>> q; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; unsigned int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=INT_MAX; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:21: error: 'INT_MAX' was not declared in this scope 34 | ans=INT_MAX; | ^~~~~~~ a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 5 | #include<math.h> +++ |+#include <climits> 6 | struct crq{
s447095260
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> #include<math.h> struct crq{ int cost; int ticket; int now; bool operator >(const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; priority_queue<crq,vector<crq>,greater<crq>> q; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; unsigned int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=INT_MAX; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:21: error: 'INT_MAX' was not declared in this scope 34 | ans=INT_MAX; | ^~~~~~~ a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 5 | #include<math.h> +++ |+#include <climits> 6 | struct crq{
s954886650
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> #include<math.h> struct crq{ int cost; int ticket; int now; bool operator >(const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; priority_queue<crq,vector<crq>,greater<crq>> q; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; unsigned int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=INT_MAX; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:21: error: 'INT_MAX' was not declared in this scope 34 | ans=INT_MAX; | ^~~~~~~ a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 5 | #include<math.h> +++ |+#include <climits> 6 | struct crq{
s493623224
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> //#include<math.h> struct crq{ int cost; int ticket; int now; bool operator >(const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; priority_queue<crq,vector<crq>,greater<crq>> q; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=INT_MAX; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:36:21: error: 'INT_MAX' was not declared in this scope 36 | ans=INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include<queue> +++ |+#include <climits> 5 | //#include<math.h>
s335535985
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> //#include<math.h> struct crq{ int cost; int ticket; int now; bool operator > (const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=INT_MAX; priority_queue<crq,vector<crq>,greater<crq>> q; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:37:21: error: 'INT_MAX' was not declared in this scope 37 | ans=INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include<queue> +++ |+#include <climits> 5 | //#include<math.h>
s646470480
p00212
C++
#include<iostream> using namespace std; #include<vector> #include<queue> //#include<math.h> struct crq{ int cost; int ticket; int now; bool operator > (const crq& p) const{ return cost > p.cost; } };//cost root que struct root{ int s; int g; int cost; }; vector<root> vr; int c; int n; int m; int s; int d; int ans; bool townSearched[100]; int townMin[100][11]; int main(){ while(cin>>c>>n>>m>>s>>d, c|n|m|s|d){ vr.clear(); ans=0; priority_queue<crq,vector<crq>,greater<crq>> q; while(!q.empty())q.pop(); for(int i=0;i<100;i++){ townSearched[i]=false; for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; } for(int i=0;i<m;i++){ root r; cin>>r.s; r.s--; cin>>r.g; r.g--; cin>>r.cost; vr.push_back(r); } townMin[s-1][c]=0; crq start; start.cost=0; start.ticket=c; start.now=s-1; q.push(start); while(1){ crq crq2=q.top();q.pop(); if(crq2.now==d-1){ ans=crq2.cost; break; } for(int i=0;i<m;i++){ if(vr.at(i).s==crq2.now){ if(!townSearched[vr.at(i).g]&&townMin[vr.at(i).g][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).g]&&crq2.ticket>0&&townMin[vr.at(i).g][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).g; townMin[vr.at(i).g][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } if(vr.at(i).g==crq2.now){ if(!townSearched[vr.at(i).s]&&townMin[vr.at(i).s][crq2.ticket]>crq2.cost+vr.at(i).cost){ crq add; add.cost=crq2.cost+vr.at(i).cost; add.ticket=crq2.ticket; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost; q.push(add); } if(!townSearched[vr.at(i).s]&&crq2.ticket>0&&townMin[vr.at(i).s][crq2.ticket-1]>crq2.cost+vr.at(i).cost/2){ crq add; add.cost=crq2.cost+vr.at(i).cost/2; add.ticket=crq2.ticket-1; add.now=vr.at(i).s; townMin[vr.at(i).s][crq2.ticket]=crq2.cost+vr.at(i).cost/2; q.push(add); } } } townSearched[crq2.now]=true; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:42:61: error: 'INT_MAX' was not declared in this scope 42 | for(int j=0;j<11;j++)townMin[i][j]=INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include<queue> +++ |+#include <climits> 5 | //#include<math.h>
s872043693
p00212
C++
#include <iostream> #include <queue> #include <functional> #include <algorithm> const int MAX_V = 100; const int INF = 0x3f3f3f3f; //??? T???cap??????rev????????°???????????§?????£??????????????? struct Edge{ int to; int cost; Edge(int to_, int cost_) :to(to_), cost(cost_){} }; std::vector<Edge > G[MAX_V]; //??£??\????????? int d[11][MAX_V]; //[?????¨???????????±??????????????°][?????????] int pre[MAX_V]; void AddEdge(int from, int to, int cost){ G[from].push_back(Edge(to, cost)); } void ClearEdge(){ for (int i = 0; i < MAX_V; ++i) G[i].clear(); memset(d, 0, sizeof(d)); memset(pre, -1, sizeof(pre)); } void Dijkstra(int c, int s){ typedef std::pair<int, int> P; //first:???????????¢, second:???????????? std::priority_queue<P, std::vector<P>, std::greater<P> > q; std::fill(d[c], d[c] + MAX_V, INF); memset(pre, -1, sizeof(pre)); d[c][s] = 0; q.push(P(0, s)); while (!q.empty()){ P p = q.top(); q.pop(); int from = p.second; if (d[c][from] < p.first) continue; for (Edge e : G[from]){ int dmin; if (c == 0) dmin = d[c][from] + e.cost; else dmin = std::min(d[c][from] + e.cost, d[c - 1][from] + e.cost / 2); if (d[c][e.to] > dmin){ d[c][e.to] = dmin; q.push(P(d[c][e.to], e.to)); pre[e.to] = from; } } } } std::vector<int> GetPath(int t){ std::vector<int> path; for (; t != -1; t = pre[t]) path.push_back(t); std::reverse(path.begin(), path.end()); return path; } using namespace std; int main(void){ int c, n, m, s, g; while (1){ cin >> c >> n >> m >> s >> g; if (c == n && n == m && m == s && s == g && g == 0) return 0; int a, b, f; for (int i = 0; i < n; ++i){ cin >> a >> b >> f; AddEdge(a, b, f); AddEdge(b, a, f); } for (int i = 0; i <= c; ++i){ Dijkstra(i, s); } cout << d[c][g] << endl; ClearEdge(); } }
a.cc: In function 'void ClearEdge()': a.cc:27:9: error: 'memset' was not declared in this scope 27 | memset(d, 0, sizeof(d)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <algorithm> +++ |+#include <cstring> 5 | a.cc: In function 'void Dijkstra(int, int)': a.cc:36:9: error: 'memset' was not declared in this scope 36 | memset(pre, -1, sizeof(pre)); | ^~~~~~ a.cc:36:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s438579090
p00212
C++
#include<bits/stdc++.h> using namespace std; #define pb push_back #define fr first #define sc second typedef pair<int, int> Pii; typedef pair<int, Pii> Pip; typedef vector<int> Vi; const int INF = (1<<25); const int MAX_V = 101; const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1}; struct edge { int to, cost; edge(int _to, int _cost) { to = _to; cost = _cost; } }; int dij(int s, int c, int g) { priority_queue<Pip, vector<Pip>, greater<Pip> > q; int d[11][101]; for(int i=0; i<11; i++) { for(int j=0; j<101; j++) { d[i][j] = INF; } } d[c][s] = 0; q.push(Pip(0, Pii(s, c))); int result = INF; while( !q.empty() ) { Pip p = q.top(); q.pop(); int now_cost = p.fr; int v = p.sc.fr; int c = p.sc.sc; if( v == g ) { result = now_cost; break; } for(int i=0; i<G[v].size(); i++) { edge e = G[v][i]; int next_cost = d[c][v] + e.cost; if( next_cost < d[c][e.to] ) { d[c][e.to] = next_cost; } if( c ) { next_cost = d[c][v] + e.cost/2; if( next_cost < d[c-1][e.to] ) { d[c-1][e.to] = next_cost; q.push(Pip(next_cost, Pii(e.to, c-1))); } } } } return result; } int main() { int c, n, m, s, g; while( cin >> c >> n >> m >> s >> g, c || n || m || s || g ) { init(n); s--; g--; for(int i=0; i<m; i++) { int u, v, cost; cin >> u >> v >> cost; u--; v--; G[u].pb(edge(v, cost)); G[v].pb(edge(u, cost)); } int ans = dij(s, c, g); cout << ans << endl; } }
a.cc: In function 'int dij(int, int, int)': a.cc:45:20: error: 'G' was not declared in this scope 45 | for(int i=0; i<G[v].size(); i++) { | ^ a.cc: In function 'int main()': a.cc:67:5: error: 'init' was not declared in this scope; did you mean 'int'? 67 | init(n); | ^~~~ | int a.cc:73:7: error: 'G' was not declared in this scope 73 | G[u].pb(edge(v, cost)); | ^
s255738466
p00212
C++
include<bits/stdc++.h> #define F first #define S second #define INF 1<<28 using namespace std; int c, n, s, d; typedef pair < int, int > P; typedef pair < int, P > PP; vector < P > vec[111]; int solve(){ int dist[111][11]; for(int i=0;i<111;i++)for(int j=0;j<11;j++) dist[i][j] = INF; priority_queue < PP, vector<PP>, greater<PP> > que; dist[s][c] = 0; que.push( PP(0, P(s, c)) ); //Now_cost, Now_node, Now_ticket while(!que.empty()){ PP p = que.top(); que.pop(); int cost = p.F, now = p.S.F, tic = p.S.S; //if(dist[now][tic] < cost) continue; for(int i=0;i<vec[now].size();i++){ P to = vec[now][i]; if(dist[to.S][tic] > dist[now][tic] + to.F){ dist[to.S][tic] = dist[now][tic] + to.F; que.push( PP(dist[to.S][tic], P(to.S, tic)) ); } if(tic && dist[to.S][tic-1] > dist[now][tic] + to.F/2){ dist[to.S][tic-1] = dist[now][tic] + to.F/2; que.push( PP(dist[to.S][tic-1], P(to.S, tic-1)) ); } } } int ans = INF; for(int i=0;i<=c;i++){ ans = min(ans, dist[d][i]); } //cout << ans << endl; } return dist[d][0]; } int main(){ int m, a, b, p; while(cin >> c >> n >> m >> s >> d){ if((c|n|m|s|d) == 0) break; for(int i=0;i<111;i++) vec[i].clear(); for(;m--;){ cin >> a >> b >> p; vec[a].push_back(P(p, b)); //[now] P(cost, next); vec[b].push_back(P(p, a)); } cout << solve() << endl; } }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc:8:9: error: 'pair' does not name a type 8 | typedef pair < int, int > P; | ^~~~ a.cc:9:9: error: 'pair' does not name a type 9 | typedef pair < int, P > PP; | ^~~~ a.cc:10:1: error: 'vector' does not name a type 10 | vector < P > vec[111]; | ^~~~~~ a.cc: In function 'int solve()': a.cc:15:3: error: 'priority_queue' was not declared in this scope 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^~~~~~~~~~~~~~ a.cc:15:20: error: 'PP' was not declared in this scope 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^~ a.cc:15:24: error: 'vector' was not declared in this scope 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^~~~~~ a.cc:15:34: error: expected primary-expression before ',' token 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^ a.cc:15:36: error: 'greater' was not declared in this scope 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^~~~~~~ a.cc:15:48: error: expected primary-expression before '>' token 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^ a.cc:15:50: error: 'que' was not declared in this scope 15 | priority_queue < PP, vector<PP>, greater<PP> > que; | ^~~ a.cc:18:19: error: 'P' was not declared in this scope 18 | que.push( PP(0, P(s, c)) ); //Now_cost, Now_node, Now_ticket | ^ a.cc:21:7: error: expected ';' before 'p' 21 | PP p = que.top(); que.pop(); | ^~ | ; a.cc:22:16: error: 'p' was not declared in this scope 22 | int cost = p.F, now = p.S.F, tic = p.S.S; | ^ a.cc:25:19: error: 'vec' was not declared in this scope 25 | for(int i=0;i<vec[now].size();i++){ | ^~~ a.cc:25:23: error: 'now' was not declared in this scope 25 | for(int i=0;i<vec[now].size();i++){ | ^~~ a.cc:26:8: error: expected ';' before 'to' 26 | P to = vec[now][i]; | ^~~ | ; a.cc:27:15: error: 'to' was not declared in this scope 27 | if(dist[to.S][tic] > dist[now][tic] + to.F){ | ^~ a.cc:27:21: error: 'tic' was not declared in this scope 27 | if(dist[to.S][tic] > dist[now][tic] + to.F){ | ^~~ a.cc:31:10: error: 'tic' was not declared in this scope 31 | if(tic && dist[to.S][tic-1] > dist[now][tic] + to.F/2){ | ^~~ a.cc:31:22: error: 'to' was not declared in this scope 31 | if(tic && dist[to.S][tic-1] > dist[now][tic] + to.F/2){ | ^~ a.cc:39:32: error: 'min' was not declared in this scope 39 | for(int i=0;i<=c;i++){ ans = min(ans, dist[d][i]); } //cout << ans << endl; } | ^~~ a.cc: In function 'int main()': a.cc:48:9: error: 'cin' was not declared in this scope 48 | while(cin >> c >> n >> m >> s >> d){ | ^~~ a.cc:50:28: error: 'vec' was not declared in this scope 50 | for(int i=0;i<111;i++) vec[i].clear(); | ^~~ a.cc:53:7: error: 'vec' was not declared in this scope 53 | vec[a].push_back(P(p, b)); //[now] P(cost, next); | ^~~ a.cc:53:24: error: 'P' was not declared in this scope 53 | vec[a].push_back(P(p, b)); //[now] P(cost, next); | ^ a.cc:57:5: error: 'cout' was not declared in this scope 57 | cout << solve() << endl; | ^~~~ a.cc:57:24: error: 'endl' was not declared in this scope 57 | cout << solve() << endl; | ^~~~
s932252300
p00212
C++
#include<iostream> #include<string> #include<vector> #include<cstdio> #include<queue> #include<map> #define P pair<int,int> using namespace std; struct K { int basho, nokori, mincost; }; bool operator<(K a, K b) { return a.mincost > b.mincost; } int main() { int cost[100][11];//n???????????°????????§m????????????????°???? int B, c, d, e, f; while (scanf("%d%d%d%d%d", &B, &c, &d, &e, &f), B || c || d || e || f) { vector<P>a[100]{}; memset(cost, 0x3f, sizeof(cost)); e--; f--; cost[e][B] = 0; priority_queue<K>Q; K g; g.basho = e; g.nokori = B; g.mincost = 0; Q.push(g); for (int h = 0; h < d; h++) { int i, j, k; scanf("%d%d%d", &i, &j, &k); i--; j--; a[i].push_back(P(k, j)); a[j].push_back(P(k, i)); } while (Q.size()) { K l = Q.top(); Q.pop(); int m = l.mincost, n = l.nokori, b = l.basho; if (cost[b][n] < m)continue; for (P o : a[b]) { if (cost[o.second][n] > cost[b][n] + o.first) { cost[o.second][n] = cost[b][n] + o.first; K xx; xx.basho = o.second; xx.mincost = cost[o.second][n]; xx.nokori = n; Q.push(xx); } if (n&&cost[o.second][n-1] > cost[b][n] + o.first / 2) { cost[o.second][n - 1] = cost[b][n] + o.first / 2; K yy; yy.basho = o.second; yy.nokori = n - 1; yy.mincost = cost[o.second][n - 1]; Q.push(yy); } } } int MINCOST = 1 << 29; for (int sss = 0; sss < 11; sss++) { MINCOST = min(MINCOST, cost[f][sss]); } cout << MINCOST << endl; } }
a.cc: In function 'int main()': a.cc:21:17: error: 'memset' was not declared in this scope 21 | memset(cost, 0x3f, sizeof(cost)); | ^~~~~~ a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include<map> +++ |+#include <cstring> 7 | #define P pair<int,int>
s608759993
p00212
C++
#pragma once #include <vector> #include <queue> #include <algorithm> #include <string.h> template <size_t N, typename COST_T> class Dijkstra { public: struct Path { int connectingIndex; COST_T cost; }; struct Agent { int index; int prev_index; COST_T cost; bool operator<(const Agent& rhs) const { return cost > rhs.cost; } }; Dijkstra() { init_paths(); } void init_paths() { edges.assign(N, std::vector<Path>()); } void add_path(int from, int to, COST_T cost) { edges[from].push_back(Path{ to, cost }); } void add_path_undirected(int node1, int node2, COST_T cost) { edges[node1].push_back(Path{ node2, cost }); edges[node2].push_back(Path{ node1, cost }); } // returns cost // returns -1 if there is no reachable path COST_T find_shortest_path(int start, int goal) { // initialize que = std::priority_queue<Agent>(); this->start = start; this->goal = goal; memset(defined, 0, sizeof defined); que.push(Agent{ start }); while (!que.empty()) { Agent agent = que.top(); que.pop(); if (defined[agent.index]) { continue; } defined[agent.index] = true; prev_node[agent.index] = agent.prev_index; if (agent.index == goal) { return agent.cost; } for (auto path : edges[agent.index]) { if (!defined[path.connectingIndex]) { que.push(Agent{ path.connectingIndex, agent.index, agent.cost + path.cost }); } } } return -1; } std::vector<int> get_shortest_path() const { std::vector<int> path; int agent = goal; while (agent != start) { path.push_back(agent); agent = prev_node[agent]; } path.push_back(start); std::reverse(path.begin(), path.end()); return path; } std::vector<std::vector<Path>> edges; std::priority_queue<Agent> que; int start; int goal; int prev_node[N]; bool defined[N]; };
a.cc:1:9: warning: #pragma once in main file 1 | #pragma once | ^~~~ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s803026418
p00212
C++
typedef pair<int, int> pi; // ?????????????????? ?????¨?????? typedef pair<int, pi>P; // ????????? pi struct edge{ int to, cost; }; int C, V, E, S, D; int d[128][16]; vector<vector<edge> >G(128); void dijkstra(int s){ priority_queue<P, vector<P>, greater<P> >q; rep(i, V) rep(j, C+1) d[i][j] = INF; d[s][C] = 0; q.push(MP(0, MP(C, s))); while(!q.empty()){ P p = q.top(); q.pop(); int v = p.S.S; int c = p.S.F; rep(i, G[v].size()){ edge e = G[v][i]; if(d[e.to][c] > d[v][c] + e.cost){ d[e.to][c] = d[v][c] + e.cost; q.push(MP(d[e.to][c], MP(c, e.to))); } if( c > 0 && d[e.to][c-1] > d[v][c] + e.cost/2){ d[e.to][c-1] = d[v][c] + e.cost/2; q.push(MP(d[e.to][c-1], MP(c-1, e.to))); } } } } int main(){ while(scanf("%d%d%d%d%d", &C, &V, &E, &S, &D) && C+V+E+S+D){ S--; D--; rep(i, 128){ G[i].clear(); } rep(i, E){ int a, b, c; scanf("%d%d%d", &a, &b, &c); a--; b--; edge e; e.to = a; e.cost = c; G[b].PB(e); e.to = b; G[a].PB(e); } dijkstra(S); int res = INF; rep(i, C+1) res = min(res, d[D][i]); printf("%d\n", res); } return 0; }
a.cc:1:9: error: 'pair' does not name a type 1 | typedef pair<int, int> pi; // ?????????????????? ?????¨?????? | ^~~~ a.cc:2:9: error: 'pair' does not name a type 2 | typedef pair<int, pi>P; // ????????? pi | ^~~~ a.cc:8:1: error: 'vector' does not name a type 8 | vector<vector<edge> >G(128); | ^~~~~~ a.cc: In function 'void dijkstra(int)': a.cc:11:3: error: 'priority_queue' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^~~~~~~~~~~~~~ a.cc:11:18: error: 'P' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:11:21: error: 'vector' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^~~~~~ a.cc:11:30: error: expected primary-expression before ',' token 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:11:32: error: 'greater' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^~~~~~~ a.cc:11:43: error: expected primary-expression before '>' token 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:11:44: error: 'q' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:12:7: error: 'i' was not declared in this scope 12 | rep(i, V) rep(j, C+1) d[i][j] = INF; | ^ a.cc:12:3: error: 'rep' was not declared in this scope 12 | rep(i, V) rep(j, C+1) d[i][j] = INF; | ^~~ a.cc:14:16: error: 'MP' was not declared in this scope 14 | q.push(MP(0, MP(C, s))); | ^~ a.cc:14:10: error: 'MP' was not declared in this scope 14 | q.push(MP(0, MP(C, s))); | ^~ a.cc:17:6: error: expected ';' before 'p' 17 | P p = q.top(); q.pop(); | ^~ | ; a.cc:18:13: error: 'p' was not declared in this scope 18 | int v = p.S.S; | ^ a.cc:21:12: error: 'G' was not declared in this scope 21 | rep(i, G[v].size()){ | ^ a.cc: In function 'int main()': a.cc:37:9: error: 'scanf' was not declared in this scope 37 | while(scanf("%d%d%d%d%d", &C, &V, &E, &S, &D) && C+V+E+S+D){ | ^~~~~ a.cc:39:9: error: 'i' was not declared in this scope 39 | rep(i, 128){ | ^ a.cc:39:5: error: 'rep' was not declared in this scope 39 | rep(i, 128){ | ^~~ a.cc:55:15: error: 'INF' was not declared in this scope 55 | int res = INF; | ^~~ a.cc:57:5: error: 'printf' was not declared in this scope 57 | printf("%d\n", res); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | typedef pair<int, int> pi; // ?????????????????? ?????¨??????
s193514451
p00212
C++
typedef pair<int, int> pi; // ?????????????????? ?????¨?????? typedef pair<int, pi> P; // ????????? pi struct edge{ int to, cost; }; int C, V, E, S, D; int d[128][16]; vector<vector<edge> >G(128); void dijkstra(int s){ priority_queue<P, vector<P>, greater<P> >q; rep(i, V) rep(j, C+1) d[i][j] = INF; d[s][C] = 0; q.push(MP(0, MP(C, s))); while(!q.empty()){ P p = q.top(); q.pop(); int v = p.S.S; int c = p.S.F; rep(i, G[v].size()){ edge e = G[v][i]; if(d[e.to][c] > d[v][c] + e.cost){ d[e.to][c] = d[v][c] + e.cost; q.push(MP(d[e.to][c], MP(c, e.to))); } if( c > 0 && d[e.to][c-1] > d[v][c] + e.cost/2){ d[e.to][c-1] = d[v][c] + e.cost/2; q.push(MP(d[e.to][c-1], MP(c-1, e.to))); } } } } int main(){ while(scanf("%d%d%d%d%d", &C, &V, &E, &S, &D) && C+V+E+S+D){ S--; D--; rep(i, 128){ G[i].clear(); } rep(i, E){ int a, b, c; scanf("%d%d%d", &a, &b, &c); a--; b--; edge e; e.to = a; e.cost = c; G[b].PB(e); e.to = b; G[a].PB(e); } dijkstra(S); int res = INF; rep(i, C+1) res = min(res, d[D][i]); printf("%d\n", res); } return 0; }
a.cc:1:9: error: 'pair' does not name a type 1 | typedef pair<int, int> pi; // ?????????????????? ?????¨?????? | ^~~~ a.cc:2:9: error: 'pair' does not name a type 2 | typedef pair<int, pi> P; // ????????? pi | ^~~~ a.cc:8:1: error: 'vector' does not name a type 8 | vector<vector<edge> >G(128); | ^~~~~~ a.cc: In function 'void dijkstra(int)': a.cc:11:3: error: 'priority_queue' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^~~~~~~~~~~~~~ a.cc:11:18: error: 'P' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:11:21: error: 'vector' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^~~~~~ a.cc:11:30: error: expected primary-expression before ',' token 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:11:32: error: 'greater' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^~~~~~~ a.cc:11:43: error: expected primary-expression before '>' token 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:11:44: error: 'q' was not declared in this scope 11 | priority_queue<P, vector<P>, greater<P> >q; | ^ a.cc:12:7: error: 'i' was not declared in this scope 12 | rep(i, V) rep(j, C+1) d[i][j] = INF; | ^ a.cc:12:3: error: 'rep' was not declared in this scope 12 | rep(i, V) rep(j, C+1) d[i][j] = INF; | ^~~ a.cc:14:16: error: 'MP' was not declared in this scope 14 | q.push(MP(0, MP(C, s))); | ^~ a.cc:14:10: error: 'MP' was not declared in this scope 14 | q.push(MP(0, MP(C, s))); | ^~ a.cc:17:6: error: expected ';' before 'p' 17 | P p = q.top(); q.pop(); | ^~ | ; a.cc:18:13: error: 'p' was not declared in this scope 18 | int v = p.S.S; | ^ a.cc:21:12: error: 'G' was not declared in this scope 21 | rep(i, G[v].size()){ | ^ a.cc: In function 'int main()': a.cc:37:9: error: 'scanf' was not declared in this scope 37 | while(scanf("%d%d%d%d%d", &C, &V, &E, &S, &D) && C+V+E+S+D){ | ^~~~~ a.cc:39:9: error: 'i' was not declared in this scope 39 | rep(i, 128){ | ^ a.cc:39:5: error: 'rep' was not declared in this scope 39 | rep(i, 128){ | ^~~ a.cc:55:15: error: 'INF' was not declared in this scope 55 | int res = INF; | ^~~ a.cc:57:5: error: 'printf' was not declared in this scope 57 | printf("%d\n", res); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | typedef pair<int, int> pi; // ?????????????????? ?????¨??????
s496669719
p00212
C++
#include "bits/stdc++.h" using namespace std; const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55); #define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++) #define rep(i,n) FOR(i,0,n) template<typename T> void dbg(T x) { cout << x << "\n"; } template<typename T, typename U> static void chmin(T &x, U y) { if (y < x) x = y; } template<typename T, typename U> static void chmax(T &x, U y) { if (x < y) x = y; } int n, m; // O(n^2) using Dist = int; const int VMAX = 110; Dist cost[VMAX][VMAX]; Dist d[12][VMAX]; void dijkstra(int s, int a) { d[a][s] = 0; vector<int> used(n, 0); while (1) { int v = -1; for (int to = 0; to < n; to++) { if (used[to]) continue; if (v == -1 || d[a][to] < d[a][v]) v = to; } if (v == -1) break; used[v] = 1; for (int to = 0; to < n; to++) { Dist nd = d[a][v] + cost[v][to]; if (a > 0) chmin(nd, d[a - 1][v] + cost[v][to] / 2); if (nd < d[a][to]) d[a][to] = nd; } } } void init() { fill_n(*d, 12 * VMAX, INF); fill_n(*cost, VMAX * VMAX, INF); } int main() { int c, s, t; while (cin >> c >> n >> m >> s >> t, c) { init(); s--; t--; rep(i, m) { int a, b, f; cin >> a >> b >> f; a--; b--; cost[a][b] = cost[b][a] = f; } rep(a, c + 1) dijkstra(s, a); cout << d[c][t] << "\n"; } return 0; }
a.cc:3:54: error: 'll' does not name a type 3 | const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55); | ^~