답안 #209530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209530 2020-03-14T12:47:34 Z model_code Island (NOI18_island) C++17
51 / 100
6 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1004;
int N, M, fac[MAXN];
bitset<MAXN> adjMat[MAXN];
int main() {
	scanf("%d%d", &N, &M);
	assert(N + M <= 1000);
	for (int i = 0, u, v; i < N+M-1; ++i) {
		scanf("%d%d", &u, &v);
		adjMat[u][v] = 1;
		adjMat[v][u] = 1;
	}
	for (int i = 1; i <= N+M; ++i) {
		int cnt = 0;
		for (int k = 1; k <= N+M; ++k) {
			cnt += adjMat[i][k];
		}
		fac[cnt-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:7: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:10: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 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 6 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 6 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 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -