# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127728 | ainta | 철도 요금 (JOI16_ho_t3) | C++17 | 2 ms | 504 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<cstdio>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
#define pii pair<int,int>
int n, K;
char p[101000];
map<pii, int>Map;
vector<pii> TP;
struct point {
int x, y;
};
int main() {
int i, j, x = 0, y = 0;
scanf("%d%d", &n, &K);
scanf("%s", p);
Map[{0, 0}] = 1;
for (i = 0; i < n; i++) {
if (p[i] == 'E')x++;
if (p[i] == 'W')x--;
if (p[i] == 'N')y++;
if (p[i] == 'S')y--;
Map[{x, y}] = 1;
}
if (x == 0 && y == 0) {
int res = 0;
for (auto &t : Map) {
int x = t.first.first, y = t.first.second;
if (Map[{x, y}] == 1 && Map[{x + 1, y}] == 1 && Map[{x, y + 1}] == 1 && Map[{x + 1, y + 1}] == 1)res++;
}
printf("%d\n", res);
return 0;
}
for (auto &t : Map) {
pii tp = t.first;
TP.push_back({ tp.first,tp.second });
TP.push_back({ tp.first-1,tp.second });
TP.push_back({ tp.first,tp.second-1 });
TP.push_back({ tp.first-1,tp.second-1 });
}
sort(TP.begin(), TP.end());
TP.resize(unique(TP.begin(), TP.end()) - TP.begin());
for (auto &t : TP) {
}
}
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... |