Submission #694999

# Submission time Handle Problem Language Result Execution time Memory
694999 2023-02-04T16:37:18 Z rainboy Sushi (JOI16_sushi) C
5 / 100
53 ms 5868 KB
#include <stdio.h>

#define N	400000

int main() {
	static int aa[N];
	int n, q, i;

	scanf("%d%d", &n, &q);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	if (n <= 2000 && q <= 2000)
		while (q--) {
			int s, t, a, tmp;

			scanf("%d%d%d", &s, &t, &a), s--, t--;
			if (s <= t) {
				for (i = s; i <= t; i++)
					if (a < aa[i])
						tmp = a, a = aa[i], aa[i] = tmp;
			} else {
				for (i = s; i < n; i++)
					if (a < aa[i])
						tmp = a, a = aa[i], aa[i] = tmp;
				for (i = 0; i <= t; i++)
					if (a < aa[i])
						tmp = a, a = aa[i], aa[i] = tmp;
			}
			printf("%d\n", a);
		}
	return 0;
}

Compilation message

sushi.c: In function 'main':
sushi.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
sushi.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
sushi.c:16:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |    scanf("%d%d%d", &s, &t, &a), s--, t--;
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 304 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 316 KB Output is correct
8 Correct 3 ms 336 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 7 ms 340 KB Output is correct
15 Correct 5 ms 312 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 296 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 5868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 304 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 316 KB Output is correct
8 Correct 3 ms 336 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 7 ms 340 KB Output is correct
15 Correct 5 ms 312 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 296 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Incorrect 53 ms 5868 KB Output isn't correct
24 Halted 0 ms 0 KB -