Submission #894793

#TimeUsernameProblemLanguageResultExecution timeMemory
894793vjudge1Nautilus (BOI19_nautilus)C++17
0 / 100
3 ms348 KiB
// Problem: A - Nautilus // Contest: Virtual Judge - Yosik IOI contest #1 // URL: https://vjudge.net/contest/601761#problem/A // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define sz(x) (int)x.size() #define all(v) (v).begin(),(v).end() #define rall(v) ((v).rbegin()), ((v).rend()) #define out(v) for(auto& i : v) cout << i << ' '; #define F first #define S second #define int long long const ll N = 1000 + 17; const ll MOD = 1e9 + 7; const string alf = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char a[N][N]; pair <int ,int > xy[] = {{1 , 0} , {-1 , 0} , {0 , 1} , {0 , -1}}; string s; int n , m , k; bool go (int x, int y){ if (a[x][y] == '#')return false; for(int i= 0; i < s.size(); i ++){ if (s[i] == 'N'){ x --; } else if (s[i] == 'S')x ++; else if (s[i] == 'W')y ++; else y --; if (a[x][y] == '#' || x < 1 || x > n || y < 1 || y > m)return false; } return true; } void solve (){ cin >> n >> m >> k; int ans = 0; for(int i = 1; i <= n; i ++){ for(int j = 1; j <=m; j ++){ cin >> a[i][j]; } } cin >> s; for(int i = 1; i <= n; i ++){ for(int j = 1; j <= m; j ++){ if (go(i , j)){ ans ++; } } } cout << ans << endl; } signed main(){ // freopen("ones.in" , "r" , stdin) ; // freopen("ones.out" , "w" , stdout) ; ios::sync_with_stdio(false); cin.tie(0); int T = 1; // int cs = 1; // cin >>T; while (T --){ // cout <<"Case " << cs ++<< ":" << endl; solve (); // cout <<endl; } }

Compilation message (stderr)

nautilus.cpp: In function 'bool go(long long int, long long int)':
nautilus.cpp:33:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for(int i= 0; i < s.size(); i ++){
      |                ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...