Submission #568156

#TimeUsernameProblemLanguageResultExecution timeMemory
568156mat_vNautilus (BOI19_nautilus)C++14
100 / 100
212 ms968 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i)) #define mod 998244353 #define xx first #define yy second #define all(a) (a).begin(), (a).end() #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int n,m,k; bitset<502*502> doz, poc; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m >> k; ff(j,0,m+1)doz[j] = 0; ff(j,0,m+1)doz[j+(n+1)*(m+2)] = 0; ff(i,1,n){ string s; cin >> s; doz[i*(m+2)] = 0; doz[i*(m+2)+m+1] = 0; ff(j,0,m - 1){ if(s[j] == '.')doz[i*(m+2)+j+1] = 1; else doz[i*(m+2)+j+1] = 0; } } poc = doz; string s; cin >> s; ff(i,0,k - 1){ if(s[i] == 'N'){ poc = doz&(poc>>(m+2)); } if(s[i] == 'E'){ poc = doz&(poc<<1); } if(s[i] == 'W'){ poc = doz&(poc>>1); } if(s[i] == 'S'){ poc = doz&(poc<<(m+2)); } if(s[i] == '?'){ poc = doz&((poc<<1)|(poc>>1)|(poc<<(m+2))|(poc>>(m+2))); } } int ans = 0; ff(i,1,n){ ff(j,1,m){ if(poc[i*(m+2)+j])ans++; } } cout << ans << "\n"; return 0; }

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:35:5: note: in expansion of macro 'ff'
   35 |     ff(j,0,m+1)doz[j] = 0;
      |     ^~
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:36:5: note: in expansion of macro 'ff'
   36 |     ff(j,0,m+1)doz[j+(n+1)*(m+2)] = 0;
      |     ^~
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:38:5: note: in expansion of macro 'ff'
   38 |     ff(i,1,n){
      |     ^~
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:43:9: note: in expansion of macro 'ff'
   43 |         ff(j,0,m - 1){
      |         ^~
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:51:5: note: in expansion of macro 'ff'
   51 |     ff(i,0,k - 1){
      |     ^~
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:69:5: note: in expansion of macro 'ff'
   69 |     ff(i,1,n){
      |     ^~
nautilus.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
nautilus.cpp:70:9: note: in expansion of macro 'ff'
   70 |         ff(j,1,m){
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...