# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
771415 | gggkik | 영역 (JOI16_ho_t4) | C++14 | 701 ms | 262144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
#define ll long long
set<pii> s;
int dx[512], dy[512];
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, k; cin >> n >> k;
string A; cin >> A;
dx['S']--, dx['N']++, dy['E']++, dy['W']--;
int x = 0, y = 0;
s.insert({x,y});
for(;k--;){
for(char i : A) {
x += dx[i], y += dy[i];
s.insert({x,y});
}
}
ll c = 0;
for(auto i : s) if(
s.find({i.first+1,i.second}) != s.end() &&
s.find({i.first,i.second+1}) != s.end() &&
s.find({i.first+1,i.second+1}) != s.end()
) c++;
cout << c;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |