# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
414698 | 2021-05-31T04:20:04 Z | juggernaut | Nautilus (BOI19_nautilus) | C++17 | 9 ms | 2764 KB |
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} typedef long long ll; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef IOI2021SG #define printl(args...)printf(args) #else #define printl(args...)((void)0) #endif int n,m,q; bool a[105][105]; bool dp[105][105][105]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin>>n>>m>>q; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){ char ch; cin>>ch; a[i][j]=(ch=='.'); dp[i][j][q]=a[i][j]; } string s; cin>>s; reverse(s.begin(),s.end()); for(int k=q-1;k>=0;k--){ char ch=s[k]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j]){ if(ch=='N'||ch=='?')dp[i][j][k]|=dp[i+1][j][k+1]; if(ch=='S'||ch=='?')dp[i][j][k]|=dp[i-1][j][k+1]; if(ch=='W'||ch=='?')dp[i][j][k]|=dp[i][j+1][k+1]; if(ch=='E'||ch=='?')dp[i][j][k]|=dp[i][j-1][k+1]; } } int cnt=0; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)cnt+=dp[i][j][0]; cout<<cnt; } /* 5 9 7 ...##.... ..#.##..# ..#....## .##...#.. ....#.... WS?EE?? */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1436 KB | Output is correct |
2 | Correct | 6 ms | 1360 KB | Output is correct |
3 | Correct | 9 ms | 1408 KB | Output is correct |
4 | Correct | 7 ms | 1356 KB | Output is correct |
5 | Correct | 6 ms | 1356 KB | Output is correct |
6 | Correct | 2 ms | 1356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1436 KB | Output is correct |
2 | Correct | 6 ms | 1360 KB | Output is correct |
3 | Correct | 9 ms | 1408 KB | Output is correct |
4 | Correct | 7 ms | 1356 KB | Output is correct |
5 | Correct | 6 ms | 1356 KB | Output is correct |
6 | Correct | 2 ms | 1356 KB | Output is correct |
7 | Correct | 5 ms | 1356 KB | Output is correct |
8 | Correct | 8 ms | 1408 KB | Output is correct |
9 | Correct | 8 ms | 1356 KB | Output is correct |
10 | Correct | 5 ms | 1356 KB | Output is correct |
11 | Correct | 2 ms | 1356 KB | Output is correct |
12 | Correct | 7 ms | 1420 KB | Output is correct |
13 | Correct | 8 ms | 1360 KB | Output is correct |
14 | Correct | 9 ms | 1404 KB | Output is correct |
15 | Correct | 8 ms | 1412 KB | Output is correct |
16 | Correct | 2 ms | 1356 KB | Output is correct |
17 | Correct | 8 ms | 1412 KB | Output is correct |
18 | Correct | 9 ms | 1356 KB | Output is correct |
19 | Correct | 8 ms | 1408 KB | Output is correct |
20 | Correct | 7 ms | 1300 KB | Output is correct |
21 | Correct | 2 ms | 1360 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1436 KB | Output is correct |
2 | Correct | 6 ms | 1360 KB | Output is correct |
3 | Correct | 9 ms | 1408 KB | Output is correct |
4 | Correct | 7 ms | 1356 KB | Output is correct |
5 | Correct | 6 ms | 1356 KB | Output is correct |
6 | Correct | 2 ms | 1356 KB | Output is correct |
7 | Correct | 5 ms | 1356 KB | Output is correct |
8 | Correct | 8 ms | 1408 KB | Output is correct |
9 | Correct | 8 ms | 1356 KB | Output is correct |
10 | Correct | 5 ms | 1356 KB | Output is correct |
11 | Correct | 2 ms | 1356 KB | Output is correct |
12 | Correct | 7 ms | 1420 KB | Output is correct |
13 | Correct | 8 ms | 1360 KB | Output is correct |
14 | Correct | 9 ms | 1404 KB | Output is correct |
15 | Correct | 8 ms | 1412 KB | Output is correct |
16 | Correct | 2 ms | 1356 KB | Output is correct |
17 | Correct | 8 ms | 1412 KB | Output is correct |
18 | Correct | 9 ms | 1356 KB | Output is correct |
19 | Correct | 8 ms | 1408 KB | Output is correct |
20 | Correct | 7 ms | 1300 KB | Output is correct |
21 | Correct | 2 ms | 1360 KB | Output is correct |
22 | Runtime error | 4 ms | 2764 KB | Execution killed with signal 11 |
23 | Halted | 0 ms | 0 KB | - |