답안 #391626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
391626 2021-04-19T12:38:32 Z maomao90 Arcade (NOI20_arcade) C++14
0 / 100
1 ms 204 KB
#include <bits/stdc++.h> 
using namespace std;

#define mnto(x, y) x = min(x, (__typeof__(x)) y)
#define mxto(x, y) x = max(x, (__typeof__(x)) y)
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s; i >= e; i--)
typedef long long ll;
typedef long double ld;
#define MP make_pair
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define MT make_tuple
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define pb emplace_back
typedef vector<int> vi;
typedef vector<ii> vii;

#define INF 1000000005
#define LINF 1000000000000000005
#define MOD 1000000007
#define MAXN 500005

int n, m;
ii ta[MAXN], xy[MAXN];
vii arr;
int ans;

int main() {
	scanf("%d%d", &n, &m);
	REP (i, 0, m) {
		scanf("%d", &ta[i].FI);
	}
	REP (i, 0, m) {
		scanf("%d", &ta[i].SE);
	}
	REP (i, 0, m) {
		xy[i] = MP(ta[i].FI + ta[i].SE, ta[i].FI - ta[i].SE);
	}
	sort(xy, xy + n);
	REP (i, 1, m) {
		if (xy[i].FI != xy[i - 1].FI) {
			arr.pb(xy[i - 1]);
		}
	}
	arr.pb(xy[n - 1]);
	ans = 1;
	REP (i, 1, arr.size()) {
		if (arr[i].SE >= arr[i - 1].SE) continue;
		ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

Arcade.cpp: In function 'int main()':
Arcade.cpp:6:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 | #define REP(i, s, e) for (int i = s; i < e; i++)
......
   51 |  REP (i, 1, arr.size()) {
      |       ~~~~~~~~~~~~~~~~                  
Arcade.cpp:51:2: note: in expansion of macro 'REP'
   51 |  REP (i, 1, arr.size()) {
      |  ^~~
Arcade.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
Arcade.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |   scanf("%d", &ta[i].FI);
      |   ~~~~~^~~~~~~~~~~~~~~~~
Arcade.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |   scanf("%d", &ta[i].SE);
      |   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -