Submission #493603

# Submission time Handle Problem Language Result Execution time Memory
493603 2021-12-12T10:42:50 Z Fysty Nautilus (BOI19_nautilus) C++14
100 / 100
191 ms 964 KB
#include <bits/stdc++.h>
#include <random>
#include <chrono>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T> void _do(T x){cerr<<x<<"\n";}
template<typename T,typename ...U> void _do(T x,U ...y){cerr<<x<<", ";_do(y...);}
#define dbg(...) cerr<<#__VA_ARGS__<<" = ";_do(__VA_ARGS__);

const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=3e18;
const ld PI=3.14159265358979323846;
ll gcd(ll a,ll b){if(b==0) return a; return gcd(b,a%b);}
ll fpow(ll a,ll b,ll m)
{
    if(!b) return 1;
    ll ans=fpow(a*a%m,b/2,m);
    return (b%2?ans*a%m:ans);
}
ll inv(ll a,ll m) {return fpow(a,m-2,m);}

#define MottoHayaku ios::sync_with_stdio(false);cin.tie(0);
//#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define uni(c) c.resize(distance(c.begin(),unique(c.begin(),c.end())))
#define unisort(c) sort(c.begin(),c.end()),uni(c)
bitset<251000> can,st;
signed main()
{
    MottoHayaku
    ll n,m,k;
    cin>>n>>m>>k;
    rep(i,n)
    {
        rep1(j,m)
        {
            char c;
            cin>>c;
            if(c=='.') st[i*(m+2)+j]=1;
        }
    }
    string s;
    cin>>s;
    can=st;
    rep(i,s.size())
    {
        if(s[i]=='W') can=st&(can>>1);
        else if(s[i]=='E') can=st&(can<<1);
        else if(s[i]=='N') can=st&(can>>(m+2));
        else if(s[i]=='S') can=st&(can<<(m+2));
        else can=st&((can>>1)|(can<<1)|(can>>(m+2))|(can<<(m+2)));
    }
    cout<<can.count();
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:35:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 | #define rep(i,n) for(int i=0;i<n;i++)
......
   63 |     rep(i,s.size())
      |         ~~~~~~~~~~             
nautilus.cpp:63:5: note: in expansion of macro 'rep'
   63 |     rep(i,s.size())
      |     ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 588 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 588 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 4 ms 588 KB Output is correct
15 Correct 3 ms 588 KB Output is correct
16 Correct 3 ms 588 KB Output is correct
17 Correct 4 ms 588 KB Output is correct
18 Correct 4 ms 588 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 588 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 588 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 588 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 4 ms 588 KB Output is correct
15 Correct 3 ms 588 KB Output is correct
16 Correct 3 ms 588 KB Output is correct
17 Correct 4 ms 588 KB Output is correct
18 Correct 4 ms 588 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 588 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
22 Correct 86 ms 892 KB Output is correct
23 Correct 86 ms 892 KB Output is correct
24 Correct 84 ms 832 KB Output is correct
25 Correct 85 ms 892 KB Output is correct
26 Correct 82 ms 844 KB Output is correct
27 Correct 131 ms 892 KB Output is correct
28 Correct 131 ms 900 KB Output is correct
29 Correct 132 ms 844 KB Output is correct
30 Correct 133 ms 896 KB Output is correct
31 Correct 129 ms 964 KB Output is correct
32 Correct 159 ms 864 KB Output is correct
33 Correct 191 ms 844 KB Output is correct
34 Correct 164 ms 856 KB Output is correct
35 Correct 159 ms 964 KB Output is correct
36 Correct 165 ms 844 KB Output is correct