제출 #496296

#제출 시각아이디문제언어결과실행 시간메모리
496296Nuraly_SerikbayNautilus (BOI19_nautilus)C++14
29 / 100
3 ms332 KiB
#include <bits/stdc++.h> #define endl "\n" #define mp make_pair #define pb push_back #define F first #define S second #define sz size() #define rep(i,k,n) for(int i = k ; i <= n ; ++i) #define per(i,k,n) for(int i = k ; i >= n ; --i) #define Zymraq() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define all(x) x.begin(),x.end() #define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout) #define toqta return 0 #define PERMUTE next_permutation #define no cout<<"No"<<endl; #define yes cout<<"Yes"<<endl; #define a() a + 1, a + n + 1 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string S; typedef double ld; typedef long double lld; const int N = 1e6 + 17; const int modd = 1e9 + 7; const int INF = 1e9 - 19; const int P = 37; const ll NN = 1e7 + 17; const ld eps = 1e-19; const double pi = 3.141592653589793238462643383279 ; bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){ return (a.second < b.second); } void pre (ll a) { cout << fixed << setprecision(a); return; } ll n, m, ss; string s; char c[200][200]; bool cor[200][200]; inline void Solution () { cin >> n >> m >> ss; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { cin >> c[i][j]; } } cin >> s; ll x, y, cnt, totalans = 0; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { x = i, y = j; cnt = 0; if (c[x][y] != '#') { cnt ++; } for (int k = 0; k < s.size(); ++ k) { if (s[k] == 'W') { if (y > 1 && c[x][y - 1] != '#') { y --; cnt ++; } } if (s[k] == 'E') { if (y < m && c[x][y + 1] != '#') { y ++; cnt ++; } else break; } if (s[k] == 'N') { if (x > 1 && c[x - 1][y] != '#') { x --; cnt ++; } else break; } if (s[k] == 'S') { if (x < n && c[x + 1][y] != '#') { x ++; cnt ++; } else break; } if (cnt == s.size() + 1) totalans ++; } } } cout << totalans; return; } int main () { Zymraq(); Solution (); exit (0); }/* 5 9 5 ...##.... ..#.##..# ..#....## .##...#.. ....#.... WSN */

컴파일 시 표준 에러 (stderr) 메시지

nautilus.cpp: In function 'void Solution()':
nautilus.cpp:68:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |    for (int k = 0; k < s.size(); ++ k) {
      |                    ~~^~~~~~~~~~
nautilus.cpp:93:13: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   93 |     if (cnt == s.size() + 1) totalans ++;
      |         ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...