Submission #533270

#TimeUsernameProblemLanguageResultExecution timeMemory
533270rk42745417영역 (JOI16_ho_t4)C++17
15 / 100
31 ms5192 KiB
#include <bits/stdc++.h> using namespace std; #define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0); using ll = int64_t; using ull = uint64_t; using uint = uint32_t; using ld = long double; const int INF = 0x3f3f3f3f; const ll LINF = ll(4e18) + ll(2e15); const int MOD = 1e9 + 7; const double EPS = 1e-8; static int LamyIsCute = []() { EmiliaMyWife return 48763; }(); signed main() { int n, k; cin >> n >> k; assert(k == 1); string s; cin >> s; set<pair<int, int>> owo; owo.insert({0, 0}); for(int i = 0, x = 0, y = 0; i < n; i++) { if(s[i] == 'E') x++; if(s[i] == 'W') x--; if(s[i] == 'N') y++; if(s[i] == 'S') y--; owo.insert({x, y}); } int res = 0; for(const auto &[x, y] : owo) res += owo.count({x + 1, y}) && owo.count({x, y + 1}) && owo.count({x + 1, y + 1}); cout << res << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...