답안 #127728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127728 2019-07-10T04:03:36 Z ainta 철도 요금 (JOI16_ho_t3) C++17
0 / 100
2 ms 504 KB
#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

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);
  ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -