Submission #1000216

#TimeUsernameProblemLanguageResultExecution timeMemory
1000216UnforgettableplMaking Friends on Joitter is Fun (JOI20_joitter2)C++17
0 / 100
5099 ms452 KiB
#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 iter = 1;iter<=n;iter++){ 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'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...