답안 #683525

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
683525 2023-01-18T16:23:59 Z rainboy Arranging Tickets (JOI17_arranging_tickets) C
0 / 100
0 ms 212 KB
#include <stdio.h>
#include <string.h>

#define N	100000
#define M	200000

int max(int a, int b) { return a > b ? a : b; }

int main() {
	static int xx[N], yy[N], cc[N], dd[M];
	int n, m, i, a, b, l, r, tmp, ans;

	scanf("%d%d", &m, &n);
	for (i = 0; i < n; i++)
		scanf("%d%d%d", &xx[i], &yy[i], &cc[i]);
	ans = 0;
	for (a = 0; a < m; a++) {
		memset(dd, 0, m * sizeof *dd);
		for (i = 0; i < n; i++) {
			l = (xx[i] - a + m) % m, r = (yy[i] - a + m) % m;
			if (l > r)
				tmp = l, l = r, r = tmp;
			dd[l]++, dd[r]--;
		}
		for (b = 1; b < m; b++)
			dd[b] += dd[b - 1];
		ans = 0;
		for (b = 1; b < m; b++)
			ans = max(ans, dd[b]);
	}
	printf("%d\n", (ans + 1) / 2);
	return 0;
}

Compilation message

arranging_tickets.c: In function 'main':
arranging_tickets.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d%d", &m, &n);
      |  ^~~~~~~~~~~~~~~~~~~~~
arranging_tickets.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d%d%d", &xx[i], &yy[i], &cc[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -