Submission #536320

#TimeUsernameProblemLanguageResultExecution timeMemory
536320rainboy우호 조약 체결 (JOI14_friends)C11
5 / 100
4 ms932 KiB
#include <stdio.h> #define N 100 char adj[N][N]; int n, cnt; void solve(int i, int j) { int k; if (adj[i][j] != 1) return; adj[i][j] = -1, cnt++; for (k = 0; k < n; k++) if (k != i && k != j && adj[i][k]) { if (!adj[j][k]) adj[j][k] = 1, solve(j, k); if (!adj[k][j]) adj[k][j] = 1, solve(k, j); } } int main() { int m, i, j; scanf("%d%d", &n, &m); while (m--) { scanf("%d%d", &i, &j), i--, j--; adj[i][j] = 1; } for (i = 0; i < n; i++) for (j = 0; j < n; j++) solve(i, j); printf("%d\n", cnt); return 0; }

Compilation message (stderr)

friends.c: In function 'main':
friends.c:25:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
friends.c:27:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |   scanf("%d%d", &i, &j), i--, j--;
      |   ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...