답안 #427989

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
427989 2021-06-15T06:48:36 Z Amylopectin Island (NOI18_island) C++14
100 / 100
195 ms 31236 KB
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
const int mxn = 8e5 + 10;
vector <int> pa[mxn] = {};
int ans[mxn] = {};
int fima(int l,int r)
{
    if(l > r)
        return l;
    return r;
}
int main()
{
    int i,j,n,m,f,t,ma = 0;
    scanf("%d %d",&n,&m);
    for(i=0; i<n+m-1; i++)
    {
        scanf("%d %d",&f,&t);
        pa[f].push_back(t);
        pa[t].push_back(f);
    }
    for(i=n+1; i<=n+m; i++)
    {
        ans[pa[i].size()-1] ++;
        ma = fima(ma,pa[i].size()-1);
    }
    for(i=ma; i>1; i--)
    {
        ans[i] += ans[i+1];
    }
    for(i=2; i<=ma; i++)
    {
        printf("%d %d\n",i,ans[i]);
    }
    return 0;
}

Compilation message

island.cpp: In function 'int main()':
island.cpp:16:11: warning: unused variable 'j' [-Wunused-variable]
   16 |     int i,j,n,m,f,t,ma = 0;
      |           ^
island.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d %d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~
island.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d %d",&f,&t);
      |         ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 19020 KB Output is correct
2 Correct 13 ms 18956 KB Output is correct
3 Correct 136 ms 29948 KB Output is correct
4 Correct 177 ms 31060 KB Output is correct
5 Correct 38 ms 21332 KB Output is correct
6 Correct 195 ms 31232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 19084 KB Output is correct
2 Correct 11 ms 19068 KB Output is correct
3 Correct 13 ms 19076 KB Output is correct
4 Correct 13 ms 19020 KB Output is correct
5 Correct 15 ms 19040 KB Output is correct
6 Correct 13 ms 19020 KB Output is correct
7 Correct 13 ms 19020 KB Output is correct
8 Correct 15 ms 19092 KB Output is correct
9 Correct 14 ms 19088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 19104 KB Output is correct
2 Correct 13 ms 19100 KB Output is correct
3 Correct 13 ms 19092 KB Output is correct
4 Correct 13 ms 19020 KB Output is correct
5 Correct 13 ms 19092 KB Output is correct
6 Correct 13 ms 19084 KB Output is correct
7 Correct 13 ms 19188 KB Output is correct
8 Correct 15 ms 19032 KB Output is correct
9 Correct 13 ms 19020 KB Output is correct
10 Correct 13 ms 19056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 19020 KB Output is correct
2 Correct 13 ms 18956 KB Output is correct
3 Correct 136 ms 29948 KB Output is correct
4 Correct 177 ms 31060 KB Output is correct
5 Correct 38 ms 21332 KB Output is correct
6 Correct 195 ms 31232 KB Output is correct
7 Correct 13 ms 19084 KB Output is correct
8 Correct 11 ms 19068 KB Output is correct
9 Correct 13 ms 19076 KB Output is correct
10 Correct 13 ms 19020 KB Output is correct
11 Correct 15 ms 19040 KB Output is correct
12 Correct 13 ms 19020 KB Output is correct
13 Correct 13 ms 19020 KB Output is correct
14 Correct 15 ms 19092 KB Output is correct
15 Correct 14 ms 19088 KB Output is correct
16 Correct 14 ms 19104 KB Output is correct
17 Correct 13 ms 19100 KB Output is correct
18 Correct 13 ms 19092 KB Output is correct
19 Correct 13 ms 19020 KB Output is correct
20 Correct 13 ms 19092 KB Output is correct
21 Correct 13 ms 19084 KB Output is correct
22 Correct 13 ms 19188 KB Output is correct
23 Correct 15 ms 19032 KB Output is correct
24 Correct 13 ms 19020 KB Output is correct
25 Correct 13 ms 19056 KB Output is correct
26 Correct 17 ms 19840 KB Output is correct
27 Correct 177 ms 30752 KB Output is correct
28 Correct 162 ms 31236 KB Output is correct
29 Correct 107 ms 24584 KB Output is correct
30 Correct 114 ms 28600 KB Output is correct
31 Correct 27 ms 20676 KB Output is correct
32 Correct 20 ms 20048 KB Output is correct
33 Correct 147 ms 27720 KB Output is correct
34 Correct 135 ms 26700 KB Output is correct
35 Correct 121 ms 28936 KB Output is correct
36 Correct 179 ms 28156 KB Output is correct
37 Correct 14 ms 19060 KB Output is correct