Submission #869815

# Submission time Handle Problem Language Result Execution time Memory
869815 2023-11-05T18:08:49 Z rainboy Subway (info1cup19_subway) C
100 / 100
5 ms 860 KB
#include <stdio.h>

int main() {
	int n, m, i;

	scanf("%d", &m);
	n = 1;
	while (n * (n - 1) / 2 < m)
		n++;
	printf("%d\n", n);
	for (i = 0; i < n - 1; i++)
		printf("%d %d\n", i, i - 1);
	printf("%d %d\n", n - 1, m - 1 - (n - 1) * (n - 2) / 2);
	return 0;
}

Compilation message

subway.c: In function 'main':
subway.c:6:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d", &m);
      |  ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 416 KB Output is correct
11 Correct 2 ms 756 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 5 ms 856 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 5 ms 860 KB Output is correct
19 Correct 4 ms 700 KB Output is correct
20 Correct 4 ms 604 KB Output is correct