Submission #797123

# Submission time Handle Problem Language Result Execution time Memory
797123 2023-07-29T07:00:35 Z vjudge1 Making Friends on Joitter is Fun (JOI20_joitter2) C++
0 / 100
1 ms 212 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])
                        {
                            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 Incorrect 1 ms 212 KB Output isn't correct
4 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 Incorrect 1 ms 212 KB Output isn't correct
4 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 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -