Submission #826190

# Submission time Handle Problem Language Result Execution time Memory
826190 2023-08-15T11:02:30 Z rainboy Table Tennis (info1cup20_tabletennis) C
0 / 100
23 ms 3284 KB
#include <stdio.h>
#include <string.h>

#define N	150000
#define K	400

int main() {
	static int aa[N + K];
	static char used[N + K];
	int n, m, l, r, i, j, s, cnt;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n + m; i++)
		scanf("%d", &aa[i]);
	for (l = 0; l <= m; l++)
		for (r = n + m - 1; r >= l && r >= n - 1; r--) {
			memset(used, 0, (n + m) * sizeof *used);
			s = aa[l] + aa[r], i = l, j = r, cnt = n;
			while (i < j && cnt > 0)
				if (aa[i] + aa[j] < s)
					i++;
				else if (aa[i] + aa[j] > s)
					j--;
				else
					used[i] = used[j] = 1, i++, j--, cnt -= 2;
			if (cnt == 0) {
				for (i = 0; i < n + m; i++)
					if (used[i])
						printf("%d ", i + 1);
				printf("\n");
				return 0;
			}
		}
	return 0;
}

Compilation message

tabletennis.c: In function 'main':
tabletennis.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
tabletennis.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 596 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 3284 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 292 KB Output not subsequence of input
2 Halted 0 ms 0 KB -