Submission #733865

# Submission time Handle Problem Language Result Execution time Memory
733865 2023-05-01T11:22:04 Z mosiashvililuka Making Friends on Joitter is Fun (JOI20_joitter2) C++14
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,bo[2009][2009],pas;
void ADD(int q, int w){
    bo[q][w]=1;pas++;
    if(bo[w][q]==1){
        for(int h=1; h<=a; h++){
            if(h==q||h==w) continue;
            if(bo[h][q]==0&&bo[h][w]==1){
                ADD(h,q);
                continue;
            }
            if(bo[h][w]==0&&bo[h][q]==1){
                ADD(h,q);
                continue;
            }
        }
    }
    for(int h=1; h<=a; h++){
        if(h==q||h==w) continue;
        if(bo[h][w]==1&&bo[w][h]==1&&bo[q][h]==0){
            ADD(q,h);
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b;
    for(i=1; i<=b; i++){
        cin>>c>>d;
        if(bo[c][d]==0) ADD(c,d);
        cout<<pas<<"\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -