Borderou de evaluare (job #2293593)
Utilizator | Data | 1 decembrie 2018 11:50:43 | |
---|---|---|---|
Problema | Barbar | Status | done |
Runda | Arhiva de probleme | Compilator | cpp-64 | Vezi sursa |
Scor | 0 |
Raport evaluator
Eroare de compilare:
main.cpp:3:103: error: 'int y1' redeclared as different kind of symbol
std::ifstream in("barbar.in");std::ofstream out("barbar.out");struct poz{int x,y,cost;};int n,m,x1,x2,y1,y2,viz[1001][1001],viz2[1001][1001];int dx[]={-1,0,1,0};int dy[]={0,1,0,-1};char mat[1001][1001];std::queue<poz>q;bool check(int g){for(int i=1;i<=n;i++)memset(viz2[i],0,sizeof(viz2[i]));if(viz[x1][y1]<g)return 0;q.push({x1,y1,0});while(!q.empty()){poz p=q.top();viz2[p.x][p.y]=1;q.pop();for(int i=0;i<4;i++){poz aux={p.x+dx[i],p.y+dy[i]};if(aux.x>=1 && aux.y>=1 && aux.x<=n && aux.y<=m && viz[aux.x][aux.y]>=g && !viz2[aux.x][aux.y] && mat[aux.x][aux.y]!='*'){viz2[aux.x][aux.y]=1,q.push(aux);if(aux.x==x2 && aux.y==y2){while(!q.empty())q.pop();return 1;}}}}return 0;}int bs(){int p2=1<<20,r=0,ok=0;while(p2){if(check(p2+r))r+=p2,ok=1;p2/=2;}if(!ok)return -1;return r;}int main(){in>>n>>m;for(int i=1;i<=n;i++,in>>std::ws){for(int j=1;j<=m;j++){in>>mat[i][j]>>std::ws;viz[i][j]=INT_MAX;if(mat[i][j]=='D')q.push({i,j,0}),viz[i][j]=0;else if(mat[i][j]=='I')x1=i,y1=j;else if(mat[i][j]=='O')x2=i,y2=j;}}while(!q.empty()){poz p=q.top();q.pop();for(int i=0;i<4;i++){poz aux={p.x+dx[i],p.y+dy[i],p.cost+1};if(aux.x>=1 && aux.y>=1 && aux.x<=n && aux.y<=m && mat[aux.x][aux.y]!='*')if(viz[aux.x][aux.y]>aux.cost)viz[aux.x][aux.y]=aux.cost,q.push(aux);}}out<<bs();std::cout<<'\n';return 0;}
^~
In file included from /usr/include/features.h:367:0,
from /usr/include/x86_64-linux-gnu/c++/6/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:507,
from /usr/include/c++/6/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:33,
from main.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:251:1: note: previous declaration 'double y1(double)'
__MATHCALL (y1,, (_Mdouble_));
^
main.cpp: In function 'bool check(int)':
main.cpp:4:110: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
main.cpp:5:37: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for'
main.cpp:5:50: error: invalid types 'int [1001][double(double) throw ()]' for array subscript
main.cpp:5:79: error: no matching function for call to 'std::queue<poz>::push(<brace-enclosed initializer list>)'
In file included from /usr/include/c++/6/queue:64:0,
from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:86,
from main.cpp:1:
/usr/include/c++/6/bits/stl_queue.h:242:7: note: candidate: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = poz; _Sequence = std::deque<poz, std::allocator<poz> >; std::queue<_Tp, _Sequence>::value_type = poz]
push(const value_type& __x)
^~~~
/usr/include/c++/6/bits/stl_queue.h:242:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const poz&}'
/usr/include/c++/6/bits/stl_queue.h:247:7: note: candidate: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = poz; _Sequence = std::deque<poz, std::allocator<poz> >; std::queue<_Tp, _Sequence>::value_type = poz]
push(value_type&& __x)
^~~~
/usr/include/c++/6/bits/stl_queue.h:247:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<poz>::value_type&& {aka poz&&}'
main.cpp:7:115: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
main.cpp:8:12: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'while'
main.cpp: In function 'int main()':
main.cpp:10:74: error: assignment of function 'double y1(double)'
main.cpp:10:74: error: cannot convert 'int' to 'double(double) throw ()' in assignment
Non zero exit status: 1
Ceva nu functioneaza?
- Citeste despre borderoul de evaluare.
- Daca tot nu e bine, contacteaza-ne pe forum !