답안 #1000214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000214 2024-06-17T06:17:28 Z Unforgettablepl 조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long

bool adj[50][50];

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=m;i++){
        int a,b;cin>>a>>b;
        adj[a][b] = true;
        int ans = 0;
        for(int x=1;x<=n;x++){
            for(int y=1;y<=n;y++){
                for(int z=1;z<=n;z++){
                    if(z==x)continue;
                    if(adj[x][y] and adj[y][z] and adj[z][y])adj[x][z]=true;
                }
            }
        }
        for(auto&x:adj)for(bool&y:x)if(y)ans++;
        cout << ans << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -