답안 #209531

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209531 2020-03-14T12:47:39 Z model_code Island (NOI18_island) C++17
100 / 100
95 ms 3576 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200004;
int N, M, cnt[MAXN], fac[MAXN];
int main() {
	scanf("%d%d", &N, &M);
	for (int i = 0, u, v; i < N+M-1; ++i) {
		scanf("%d%d", &u, &v);
		cnt[u-1]++;
		cnt[v-1]++;
	}
	for (int i = 0; i < N+M; ++i) {
		fac[cnt[i]-1]++;
	}
	for (int i = N+M-1; i >= 1; --i) {
		if (fac[i] > 0) {
			printf("%d %d\n", i, fac[i]);
			fac[i-1] += fac[i];
		}
		
	}

}

Compilation message

island.cpp: In function 'int main()':
island.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
island.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &u, &v);
   ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 91 ms 3320 KB Output is correct
4 Correct 91 ms 3576 KB Output is correct
5 Correct 21 ms 888 KB Output is correct
6 Correct 95 ms 3576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 5 ms 296 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 91 ms 3320 KB Output is correct
4 Correct 91 ms 3576 KB Output is correct
5 Correct 21 ms 888 KB Output is correct
6 Correct 95 ms 3576 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 380 KB Output is correct
14 Correct 5 ms 296 KB Output is correct
15 Correct 6 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 6 ms 376 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 11 ms 376 KB Output is correct
27 Correct 92 ms 3448 KB Output is correct
28 Correct 92 ms 3576 KB Output is correct
29 Correct 43 ms 760 KB Output is correct
30 Correct 74 ms 1144 KB Output is correct
31 Correct 14 ms 504 KB Output is correct
32 Correct 12 ms 352 KB Output is correct
33 Correct 67 ms 1088 KB Output is correct
34 Correct 65 ms 1016 KB Output is correct
35 Correct 82 ms 1140 KB Output is correct
36 Correct 84 ms 1148 KB Output is correct
37 Correct 5 ms 376 KB Output is correct