# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
493474 | 2021-12-11T14:39:36 Z | uncripted | Awesome Arrowland Adventure (eJOI19_adventure) | C++11 | 2000 ms | 292 KB |
#include<bits/stdc++.h> using namespace std; char r[200]; int dif(char a, char b){ int s=0; if(a=='X'){ return 10000005; } // cout<<a<<" "<<b<<endl; while(a!=b){ a=r[a]; s++; } // cout<<"end"<<endl; return s; } int main(){ r['N']='E'; r['E']='S'; r['S']='W'; r['W']='N'; int m,n; cin>>m>>n; char a[m][n]; int dp[m][n]; dp[0][0]=0; for(int i=0; i<m; i++){ for(int j=0; j<n; j++){ cin>>a[i][j]; } } dp[1][0]=dif(a[0][0], 'S'); //cout<<"dp1 "<<dp[1][0]; for(int i=1; i<n; i++){ for(int j=0; j<m; j++){ int x=dif(a[j][i-1], 'E'); int y=dif(a[1-j][i], 'N'); int y1=dif(a[1-j][i], 'S'); int z=dif(a[1-j][i-1], 'E'); if(j==0){ dp[j][i]=min(dp[j][i-1]+x, dp[1-j][i-1]+y+z); }else{ dp[j][i]=min(dp[j][i-1]+x, dp[1-j][i-1]+y1+z); } } } if(dp[m-1][n-1]>10000){ cout<<"-1"; return 0; } cout<<dp[m-1][n-1]; } /* 2 5 E E N W S E E E E X */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 292 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |