# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1026283 | 2024-07-17T18:53:35 Z | hasan2006 | Nautilus (BOI19_nautilus) | C++17 | 161 ms | 1116 KB |
#include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define se second #define fi first #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 5e5 + 9 , mod = 1e9 + 7; ll a[N] , b[N] , dp[N] , c[N] , d[N] ; bitset<250000>b1 , b2 , b3 , b4; void solve() { ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ; cin>>n>>m>>k; for(i = 0; i < n; i++){ for(j = 0; j < m; j++){ x = i * n + j; char ch; cin>>ch; if(ch == '.'){ //cout<<x<<" "; b1.set(x); b2.set(x); } if(j != m - 1) b3.set(x); if(j) b4.set(x); } } string a; cin>>a; for(i = 0; i < k; i++){ if(a[i] == '?'){ b1 = ((b1 >> m) | (b1 << m) | ((b1 >> 1) & b3) | ((b1 << 1) & b4)); }else if(a[i] == 'N'){ b1 = (b1 >> m); }else if(a[i] == 'S'){ b1 = (b1 << m); }else if(a[i] == 'W'){ b1 = ((b1 >> 1) & b3); }else { b1 = ((b1 << 1) & b4); } b1 &= b2; } cout<<b1.count(); } int main(){ TL; /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif*/ int t = 1; // cin>>t; while(t--) { solve(); } } // Author : حسن
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 2 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 2 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 2 ms | 604 KB | Output is correct |
8 | Correct | 2 ms | 604 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 3 ms | 604 KB | Output is correct |
13 | Correct | 5 ms | 788 KB | Output is correct |
14 | Correct | 4 ms | 604 KB | Output is correct |
15 | Correct | 4 ms | 744 KB | Output is correct |
16 | Correct | 4 ms | 792 KB | Output is correct |
17 | Correct | 5 ms | 600 KB | Output is correct |
18 | Correct | 3 ms | 752 KB | Output is correct |
19 | Correct | 4 ms | 604 KB | Output is correct |
20 | Correct | 4 ms | 792 KB | Output is correct |
21 | Correct | 3 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 2 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 2 ms | 604 KB | Output is correct |
8 | Correct | 2 ms | 604 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 3 ms | 604 KB | Output is correct |
13 | Correct | 5 ms | 788 KB | Output is correct |
14 | Correct | 4 ms | 604 KB | Output is correct |
15 | Correct | 4 ms | 744 KB | Output is correct |
16 | Correct | 4 ms | 792 KB | Output is correct |
17 | Correct | 5 ms | 600 KB | Output is correct |
18 | Correct | 3 ms | 752 KB | Output is correct |
19 | Correct | 4 ms | 604 KB | Output is correct |
20 | Correct | 4 ms | 792 KB | Output is correct |
21 | Correct | 3 ms | 604 KB | Output is correct |
22 | Correct | 73 ms | 1112 KB | Output is correct |
23 | Correct | 75 ms | 1112 KB | Output is correct |
24 | Correct | 80 ms | 1116 KB | Output is correct |
25 | Correct | 74 ms | 1116 KB | Output is correct |
26 | Correct | 75 ms | 1080 KB | Output is correct |
27 | Correct | 115 ms | 1116 KB | Output is correct |
28 | Correct | 115 ms | 1116 KB | Output is correct |
29 | Correct | 116 ms | 1116 KB | Output is correct |
30 | Correct | 113 ms | 1100 KB | Output is correct |
31 | Correct | 111 ms | 860 KB | Output is correct |
32 | Correct | 146 ms | 1116 KB | Output is correct |
33 | Correct | 151 ms | 1116 KB | Output is correct |
34 | Correct | 161 ms | 1112 KB | Output is correct |
35 | Correct | 151 ms | 1116 KB | Output is correct |
36 | Correct | 144 ms | 860 KB | Output is correct |