Submission #1151579

#TimeUsernameProblemLanguageResultExecution timeMemory
1151579MedetbekNautilus (BOI19_nautilus)C++20
29 / 100
2 ms328 KiB
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") #include <bits/stdc++.h> #define ll long long #define int long long #define all(v) v.begin(), v.end() #define nl '\n' #define pb push_back #define sz(s) (int)(s).size() #define f first #define s second #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using namespace std; const ll N = 2e5+10, MX = 1e18+1, MOD = 1e9 + 7; void solve(){ ll n, m, k; cin >> n >> m >> k; char a[n+2][m+2]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cin >> a[i][j]; } } string s; cin >> s; ll ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(a[i][j] == '.'){ ll x = i, y = j; ll tr = 1; for(int h = 0; h < k; h++){ if(s[h] == 'W') y--; if(s[h] == 'E') y++; if(s[h] == 'N') x--; if(s[h] == 'S') x++; if(x > n || y > m || x < 1 || y < 1 || a[x][y] != '.'){ tr=0; break; } } ans += tr; } } } cout << ans; } main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); ll ql =1; //cin>>ql; while(ql--){ solve(); } }

Compilation message (stderr)

nautilus.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...