Submission #1026276

# Submission time Handle Problem Language Result Execution time Memory
1026276 2024-07-17T18:50:04 Z hasan2006 Nautilus (BOI19_nautilus) C++17
0 / 100
2 ms 604 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()<<"\n";
}

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

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 ;
      |                                                                     ^~
nautilus.cpp: In function 'int main()':
nautilus.cpp:69:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:70:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -