Submission #493603

#TimeUsernameProblemLanguageResultExecution timeMemory
493603FystyNautilus (BOI19_nautilus)C++14
100 / 100
191 ms964 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...