Submission #816363

# Submission time Handle Problem Language Result Execution time Memory
816363 2023-08-09T04:54:41 Z 이종영(#10379) Marshmallow Molecules (CCO19_day2problem2) C++17
10 / 25
840 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
using ll=long long;
using pii=array<int,2>;
using tii=array<int,3>;
const ll inf=1e18;
const int N=1e5+5;
int n,m;
ll ans;
bitset<N> out[N],clr;
int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin>>n>>m;
	for(int u,v,i=1;i<=m;i++){
		cin>>u>>v;
		out[u][v]=1;
	}
	for(int i=1;i<=n;i++) clr[i]=1;
	for(int u=1;u<=n;u++){
		clr[u]=0;
		out[u]&=clr;
		if(out[u].count()){
			int v=out[u]._Find_first();
			out[v]|=out[u];
		}
	}
	for(int i=1;i<=n;i++) ans+=out[i].count();
	cout<<ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 2 ms 1492 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1492 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1492 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 3 ms 1492 KB Output is correct
13 Correct 3 ms 1492 KB Output is correct
14 Correct 3 ms 1500 KB Output is correct
15 Correct 2 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 2 ms 1492 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1492 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1492 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 3 ms 1492 KB Output is correct
13 Correct 3 ms 1492 KB Output is correct
14 Correct 3 ms 1500 KB Output is correct
15 Correct 2 ms 1492 KB Output is correct
16 Correct 77 ms 61488 KB Output is correct
17 Correct 76 ms 61528 KB Output is correct
18 Correct 78 ms 61572 KB Output is correct
19 Correct 81 ms 61584 KB Output is correct
20 Correct 81 ms 61596 KB Output is correct
21 Correct 70 ms 61584 KB Output is correct
22 Correct 80 ms 61616 KB Output is correct
23 Correct 111 ms 61556 KB Output is correct
24 Correct 75 ms 61616 KB Output is correct
25 Correct 111 ms 61624 KB Output is correct
26 Correct 83 ms 61532 KB Output is correct
27 Correct 67 ms 61500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 840 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 2 ms 1492 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1492 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1492 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 3 ms 1492 KB Output is correct
13 Correct 3 ms 1492 KB Output is correct
14 Correct 3 ms 1500 KB Output is correct
15 Correct 2 ms 1492 KB Output is correct
16 Correct 77 ms 61488 KB Output is correct
17 Correct 76 ms 61528 KB Output is correct
18 Correct 78 ms 61572 KB Output is correct
19 Correct 81 ms 61584 KB Output is correct
20 Correct 81 ms 61596 KB Output is correct
21 Correct 70 ms 61584 KB Output is correct
22 Correct 80 ms 61616 KB Output is correct
23 Correct 111 ms 61556 KB Output is correct
24 Correct 75 ms 61616 KB Output is correct
25 Correct 111 ms 61624 KB Output is correct
26 Correct 83 ms 61532 KB Output is correct
27 Correct 67 ms 61500 KB Output is correct
28 Runtime error 840 ms 1048576 KB Execution killed with signal 9
29 Halted 0 ms 0 KB -