제출 #1162378

#제출 시각아이디문제언어결과실행 시간메모리
1162378blackslex조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2)C++20
0 / 100
0 ms328 KiB
#include<bits/stdc++.h> using namespace std; const int N = 2005; int n, m, x, y, ans; vector<int> v[N]; bool f[N][N]; void add (int x, int y) { if (f[x][y]) return; f[x][y] = 1; ans++; for (auto &e: v[y]) { if (x != e && !f[x][e]) add(x, e); } if (f[y][x]) { for (int i = 1; i <= n; i++) { if (i != x && i != y) { if (f[i][x] && !f[i][y]) add(i, y); if (f[i][y] && !f[i][x]) add(i, x); } } v[x].emplace_back(y); v[y].emplace_back(x); } } int main() { scanf("%d %d", &n, &m); while (m--) { scanf("%d %d", &x, &y); if (!f[x][y]) add(x, y); printf("%d\n", ans); } }

컴파일 시 표준 에러 (stderr) 메시지

joitter2.cpp: In function 'int main()':
joitter2.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
joitter2.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         scanf("%d %d", &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...