Submission #127728

#TimeUsernameProblemLanguageResultExecution timeMemory
127728ainta철도 요금 (JOI16_ho_t3)C++17
0 / 100
2 ms504 KiB
#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)

2016_ho_t3.cpp: In function 'int main()':
2016_ho_t3.cpp:44:13: warning: unused variable 't' [-Wunused-variable]
  for (auto &t : TP) {
             ^
2016_ho_t3.cpp:15:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, x = 0, y = 0;
         ^
2016_ho_t3.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &K);
  ~~~~~^~~~~~~~~~~~~~~~
2016_ho_t3.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", p);
  ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...