Submission #771806

# Submission time Handle Problem Language Result Execution time Memory
771806 2023-07-03T09:38:27 Z Mohammad_Parsa Making Friends on Joitter is Fun (JOI20_joitter2) C++17
1 / 100
448 ms 468 KB
/* in the name of allah */
#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pb push_back
#define F first
#define S second
#define mk make_pair
typedef long long ll;

const int N=50+7;
int a[N][N];

int main(){
	ios:: sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,q;
	cin>>n;
	cin>>q;
	int ans=0;
	while(q--){
		int v,u;
		cin>>v>>u;
		if(a[v][u]==0)ans++;
		a[v][u]=1;
		int k=1;
		while(k){
			k=0;
			for(int x=1;x<=n;x++){
				for(int y=1;y<=n;y++){
					for(int z=1;z<=n;z++){
						if(a[x][y] && z!=x && a[x][z]==0 && a[y][z] && a[z][y]){
							k=1;
							a[x][z]=1;
							ans++;
						}
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 428 ms 340 KB Output is correct
8 Correct 448 ms 340 KB Output is correct
9 Correct 424 ms 344 KB Output is correct
10 Correct 23 ms 212 KB Output is correct
11 Correct 20 ms 212 KB Output is correct
12 Correct 20 ms 328 KB Output is correct
13 Correct 26 ms 212 KB Output is correct
14 Correct 23 ms 212 KB Output is correct
15 Correct 24 ms 324 KB Output is correct
16 Correct 23 ms 212 KB Output is correct
17 Correct 23 ms 212 KB Output is correct
18 Correct 21 ms 324 KB Output is correct
19 Correct 23 ms 336 KB Output is correct
20 Correct 66 ms 320 KB Output is correct
21 Correct 424 ms 340 KB Output is correct
22 Correct 60 ms 312 KB Output is correct
23 Correct 203 ms 328 KB Output is correct
24 Correct 88 ms 212 KB Output is correct
25 Correct 366 ms 324 KB Output is correct
26 Correct 13 ms 332 KB Output is correct
27 Correct 13 ms 316 KB Output is correct
28 Correct 20 ms 332 KB Output is correct
29 Correct 16 ms 332 KB Output is correct
30 Correct 23 ms 212 KB Output is correct
31 Correct 360 ms 328 KB Output is correct
32 Correct 24 ms 328 KB Output is correct
33 Correct 349 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 428 ms 340 KB Output is correct
8 Correct 448 ms 340 KB Output is correct
9 Correct 424 ms 344 KB Output is correct
10 Correct 23 ms 212 KB Output is correct
11 Correct 20 ms 212 KB Output is correct
12 Correct 20 ms 328 KB Output is correct
13 Correct 26 ms 212 KB Output is correct
14 Correct 23 ms 212 KB Output is correct
15 Correct 24 ms 324 KB Output is correct
16 Correct 23 ms 212 KB Output is correct
17 Correct 23 ms 212 KB Output is correct
18 Correct 21 ms 324 KB Output is correct
19 Correct 23 ms 336 KB Output is correct
20 Correct 66 ms 320 KB Output is correct
21 Correct 424 ms 340 KB Output is correct
22 Correct 60 ms 312 KB Output is correct
23 Correct 203 ms 328 KB Output is correct
24 Correct 88 ms 212 KB Output is correct
25 Correct 366 ms 324 KB Output is correct
26 Correct 13 ms 332 KB Output is correct
27 Correct 13 ms 316 KB Output is correct
28 Correct 20 ms 332 KB Output is correct
29 Correct 16 ms 332 KB Output is correct
30 Correct 23 ms 212 KB Output is correct
31 Correct 360 ms 328 KB Output is correct
32 Correct 24 ms 328 KB Output is correct
33 Correct 349 ms 336 KB Output is correct
34 Runtime error 6 ms 468 KB Execution killed with signal 11
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 428 ms 340 KB Output is correct
8 Correct 448 ms 340 KB Output is correct
9 Correct 424 ms 344 KB Output is correct
10 Correct 23 ms 212 KB Output is correct
11 Correct 20 ms 212 KB Output is correct
12 Correct 20 ms 328 KB Output is correct
13 Correct 26 ms 212 KB Output is correct
14 Correct 23 ms 212 KB Output is correct
15 Correct 24 ms 324 KB Output is correct
16 Correct 23 ms 212 KB Output is correct
17 Correct 23 ms 212 KB Output is correct
18 Correct 21 ms 324 KB Output is correct
19 Correct 23 ms 336 KB Output is correct
20 Correct 66 ms 320 KB Output is correct
21 Correct 424 ms 340 KB Output is correct
22 Correct 60 ms 312 KB Output is correct
23 Correct 203 ms 328 KB Output is correct
24 Correct 88 ms 212 KB Output is correct
25 Correct 366 ms 324 KB Output is correct
26 Correct 13 ms 332 KB Output is correct
27 Correct 13 ms 316 KB Output is correct
28 Correct 20 ms 332 KB Output is correct
29 Correct 16 ms 332 KB Output is correct
30 Correct 23 ms 212 KB Output is correct
31 Correct 360 ms 328 KB Output is correct
32 Correct 24 ms 328 KB Output is correct
33 Correct 349 ms 336 KB Output is correct
34 Runtime error 6 ms 468 KB Execution killed with signal 11
35 Halted 0 ms 0 KB -