# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
108928 |
2019-05-03T00:34:12 Z |
nxteru |
Robots (APIO13_robots) |
C++14 |
|
60 ms |
65016 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct t{
int l,r,y,x;
};
int h,w,n,dx[4]={1,0,-1,0},dy[4]={0,1,0,-1},m[505][505],dp[9][9][505][505];
vector<P>g[505][505];
vector<t>q[2500000];
void dfs(int y,int x,int d,int py,int px){
g[y][x].PB(P(py,px));
if(m[y][x]==2)d+=3;
if(m[y][x]==3)d++;
d%=4;
int ny=y+dy[d],nx=x+dx[d];
if(0<=ny&&ny<h&&0<=nx&&nx<w&&m[ny][nx]!=1)dfs(ny,nx,d,py,px);
}
int main(void){
scanf("%d%d%d",&n,&w,&h);
for(int i=0;i<n;i++)for(int j=0;j<n;j++)for(int y=0;y<h;y++)for(int x=0;x<w;x++)dp[i][j][y][x]=-1;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
char c;
scanf(" %c",&c);
if(c=='x')m[i][j]=1;
else if(c=='A')m[i][j]=2;
else if(c=='C')m[i][j]=3;
else if(c!='.'){
int p=c-'1';
dp[p][p][i][j]=0;
}
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(m[i][j]==1)continue;
for(int k=0;k<4;k++){
int ny=i+dy[k],nx=j+dx[k];
if(nx<0||nx>=w||ny<0||ny>=h||m[ny][nx]==1){
dfs(i,j,(k+2)%4,i,j);
}
}
}
}
}
Compilation message
robots.cpp: In function 'int main()':
robots.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&n,&w,&h);
~~~~~^~~~~~~~~~~~~~~~~~~
robots.cpp:31:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf(" %c",&c);
~~~~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
65016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
65016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
65016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
65016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |