Submission #797126

# Submission time Handle Problem Language Result Execution time Memory
797126 2023-07-29T07:03:52 Z vjudge1 Making Friends on Joitter is Fun (JOI20_joitter2) C++
1 / 100
655 ms 472 KB
#include<iostream>
#include<vector>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define fi first
#define se second
using namespace std ;
const int NS = 50 ;
int ans ;
bool us[NS + 1][NS + 1] ;
signed main()
{
    ios_base::sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
    int n, m ;
    cin >> n >> m ;
    while(m--)
    {
        int a, b ;
        cin >> a >> b ;
        if(!us[a][b])
        {
            ans++ ;
            us[a][b] = 1 ;
        }
        bool flag = 1 ;
        while(flag)
        {
            flag = 0 ;
            for(int x = 1 ; x <= n ; x++)
                for(int y = 1 ; y <= n ; y++)
                    for(int z = 1 ; z <= n ; z++)
                        if(x != y && x != z && y != z && us[x][y] && us[y][z] && us[z][y] && !us[x][z])
                        {
                            flag = 1 ;
                            ans++ ;
                            us[x][z] = 1 ;
                        }
        }
        cout << ans << '\n' ;
    }
    return 0 ;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 655 ms 312 KB Output is correct
8 Correct 582 ms 312 KB Output is correct
9 Correct 566 ms 432 KB Output is correct
10 Correct 39 ms 212 KB Output is correct
11 Correct 38 ms 212 KB Output is correct
12 Correct 37 ms 212 KB Output is correct
13 Correct 39 ms 212 KB Output is correct
14 Correct 41 ms 212 KB Output is correct
15 Correct 44 ms 212 KB Output is correct
16 Correct 39 ms 212 KB Output is correct
17 Correct 38 ms 212 KB Output is correct
18 Correct 39 ms 308 KB Output is correct
19 Correct 42 ms 212 KB Output is correct
20 Correct 94 ms 212 KB Output is correct
21 Correct 624 ms 316 KB Output is correct
22 Correct 99 ms 212 KB Output is correct
23 Correct 329 ms 212 KB Output is correct
24 Correct 147 ms 212 KB Output is correct
25 Correct 599 ms 308 KB Output is correct
26 Correct 25 ms 212 KB Output is correct
27 Correct 24 ms 324 KB Output is correct
28 Correct 30 ms 324 KB Output is correct
29 Correct 30 ms 320 KB Output is correct
30 Correct 41 ms 212 KB Output is correct
31 Correct 436 ms 316 KB Output is correct
32 Correct 48 ms 312 KB Output is correct
33 Correct 469 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 655 ms 312 KB Output is correct
8 Correct 582 ms 312 KB Output is correct
9 Correct 566 ms 432 KB Output is correct
10 Correct 39 ms 212 KB Output is correct
11 Correct 38 ms 212 KB Output is correct
12 Correct 37 ms 212 KB Output is correct
13 Correct 39 ms 212 KB Output is correct
14 Correct 41 ms 212 KB Output is correct
15 Correct 44 ms 212 KB Output is correct
16 Correct 39 ms 212 KB Output is correct
17 Correct 38 ms 212 KB Output is correct
18 Correct 39 ms 308 KB Output is correct
19 Correct 42 ms 212 KB Output is correct
20 Correct 94 ms 212 KB Output is correct
21 Correct 624 ms 316 KB Output is correct
22 Correct 99 ms 212 KB Output is correct
23 Correct 329 ms 212 KB Output is correct
24 Correct 147 ms 212 KB Output is correct
25 Correct 599 ms 308 KB Output is correct
26 Correct 25 ms 212 KB Output is correct
27 Correct 24 ms 324 KB Output is correct
28 Correct 30 ms 324 KB Output is correct
29 Correct 30 ms 320 KB Output is correct
30 Correct 41 ms 212 KB Output is correct
31 Correct 436 ms 316 KB Output is correct
32 Correct 48 ms 312 KB Output is correct
33 Correct 469 ms 312 KB Output is correct
34 Runtime error 8 ms 472 KB Execution killed with signal 11
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 655 ms 312 KB Output is correct
8 Correct 582 ms 312 KB Output is correct
9 Correct 566 ms 432 KB Output is correct
10 Correct 39 ms 212 KB Output is correct
11 Correct 38 ms 212 KB Output is correct
12 Correct 37 ms 212 KB Output is correct
13 Correct 39 ms 212 KB Output is correct
14 Correct 41 ms 212 KB Output is correct
15 Correct 44 ms 212 KB Output is correct
16 Correct 39 ms 212 KB Output is correct
17 Correct 38 ms 212 KB Output is correct
18 Correct 39 ms 308 KB Output is correct
19 Correct 42 ms 212 KB Output is correct
20 Correct 94 ms 212 KB Output is correct
21 Correct 624 ms 316 KB Output is correct
22 Correct 99 ms 212 KB Output is correct
23 Correct 329 ms 212 KB Output is correct
24 Correct 147 ms 212 KB Output is correct
25 Correct 599 ms 308 KB Output is correct
26 Correct 25 ms 212 KB Output is correct
27 Correct 24 ms 324 KB Output is correct
28 Correct 30 ms 324 KB Output is correct
29 Correct 30 ms 320 KB Output is correct
30 Correct 41 ms 212 KB Output is correct
31 Correct 436 ms 316 KB Output is correct
32 Correct 48 ms 312 KB Output is correct
33 Correct 469 ms 312 KB Output is correct
34 Runtime error 8 ms 472 KB Execution killed with signal 11
35 Halted 0 ms 0 KB -