Submission #1026283

#TimeUsernameProblemLanguageResultExecution timeMemory
1026283hasan2006Nautilus (BOI19_nautilus)C++17
100 / 100
161 ms1116 KiB
#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 (stderr)

nautilus.cpp: In function 'void solve()':
nautilus.cpp:28:12: warning: unused variable 'q' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |            ^
nautilus.cpp:28:23: warning: unused variable 'l' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                       ^
nautilus.cpp:28:26: warning: unused variable 'r' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                          ^
nautilus.cpp:28:34: warning: unused variable 'y' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                  ^
nautilus.cpp:28:38: warning: unused variable 's' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                      ^
nautilus.cpp:28:46: warning: unused variable 'f' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                              ^
nautilus.cpp:28:58: warning: unused variable 'mn' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                          ^~
nautilus.cpp:28:69: warning: unused variable 'mx' [-Wunused-variable]
   28 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                                     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...