제출 #797123

#제출 시각아이디문제언어결과실행 시간메모리
797123vjudge1Making Friends on Joitter is Fun (JOI20_joitter2)C++98
0 / 100
1 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...