Submission #503231

# Submission time Handle Problem Language Result Execution time Memory
503231 2022-01-07T14:41:37 Z rainboy Osumnjičeni (COCI21_osumnjiceni) C
0 / 110
142 ms 5396 KB
#include <stdio.h>

#define N	200000

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

unsigned int X = 12345;

int rand_() {
	return (X *= 3) >> 1;
}

int xx[N * 2];

void sort(int *ii, int l, int r) {
	while (l < r) {
		int i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;

		while (j < k)
			if (xx[ii[j]] == xx[i_])
				j++;
			else if (xx[ii[j]] < xx[i_]) {
				tmp = ii[i], ii[i] = ii[j], ii[j] = tmp;
				i++, j++;
			} else {
				k--;
				tmp = ii[j], ii[j] = ii[k], ii[k] = tmp;
			}
		sort(ii, l, i);
		l = k;
	}
}

int main() {
	static int ii[N * 2], dd[N * 2];
	int n, q, i, x, ans;

	scanf("%d%d", &n, &q);
	for (i = 0; i < n; i++)
		scanf("%d%d", &xx[i << 1 | 0], &xx[i << 1 | 1]), xx[i << 1 | 1]++;
	for (i = 0; i < n * 2; i++)
		ii[i] = i;
	sort(ii, 0, n * 2);
	for (i = 0, x = 0; i < n * 2; i++)
		xx[ii[i]] = i + 1 == n * 2 || xx[ii[i + 1]] != xx[ii[i]] ? x++ : x;
	for (i = 0; i < n; i++)
		dd[xx[i << 1 | 0]]++, dd[xx[i << 1 | 1]]--;
	for (i = 1; i < n * 2; i++)
		dd[i] += dd[i - 1];
	ans = 0;
	for (i = 0; i < n * 2; i++)
		ans = max(ans, dd[i]);
	printf("%d\n", ans);
	return 0;
}

Compilation message

Main.c: In function 'main':
Main.c:38:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
Main.c:40:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |   scanf("%d%d", &xx[i << 1 | 0], &xx[i << 1 | 1]), xx[i << 1 | 1]++;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 5084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 5396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 5084 KB Output isn't correct
2 Halted 0 ms 0 KB -