답안 #821061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
821061 2023-08-11T07:11:32 Z PVM_pvm Marshmallow Molecules (CCO19_day2problem2) C++17
10 / 25
1520 ms 3412 KB
#include<bits/stdc++.h>
using namespace std;
#define MAXN 5007
bitset<MAXN> gr[MAXN];
int n,m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for (int q=0;q<m;q++)
    {
        int a,b;
        cin>>a>>b;
        gr[a][b]=1;
    }
    long long ans=0;
    for (int q=1;q<=n;q++)
    {
        ans+=gr[q].count();
        while(true)
        {
            int pos=gr[q]._Find_first();
            if (pos==gr[q].size()) break;
            gr[q][pos]=0;
            gr[pos]=gr[pos]|gr[q];
        }
    }
    cout<<ans<<"\n";
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if (pos==gr[q].size()) break;
      |                 ~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1359 ms 3412 KB Output is correct
17 Correct 1438 ms 3412 KB Output is correct
18 Correct 1520 ms 3412 KB Output is correct
19 Correct 1484 ms 3412 KB Output is correct
20 Correct 1516 ms 3412 KB Output is correct
21 Correct 1265 ms 3408 KB Output is correct
22 Correct 1306 ms 3412 KB Output is correct
23 Correct 1398 ms 3412 KB Output is correct
24 Correct 1449 ms 3400 KB Output is correct
25 Correct 1513 ms 3412 KB Output is correct
26 Correct 1473 ms 3412 KB Output is correct
27 Correct 1175 ms 3400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1359 ms 3412 KB Output is correct
17 Correct 1438 ms 3412 KB Output is correct
18 Correct 1520 ms 3412 KB Output is correct
19 Correct 1484 ms 3412 KB Output is correct
20 Correct 1516 ms 3412 KB Output is correct
21 Correct 1265 ms 3408 KB Output is correct
22 Correct 1306 ms 3412 KB Output is correct
23 Correct 1398 ms 3412 KB Output is correct
24 Correct 1449 ms 3400 KB Output is correct
25 Correct 1513 ms 3412 KB Output is correct
26 Correct 1473 ms 3412 KB Output is correct
27 Correct 1175 ms 3400 KB Output is correct
28 Runtime error 1 ms 468 KB Execution killed with signal 11
29 Halted 0 ms 0 KB -