Submission #473037

#TimeUsernameProblemLanguageResultExecution timeMemory
473037rainboyPlaninarenje (COCI18_planinarenje)C11
48 / 160
7 ms1096 KiB
#include <stdio.h> #define N 10 int dp[1 << N + N][N + N], n; char adj[N + N][N + N], visited[1 << N + N][N + N]; int dfs(int b, int i) { if (!visited[b][i]) { int j; visited[b][i] = 1; for (j = 0; j < n + n; j++) if (adj[i][j] && (b & 1 << j) == 0 && !dfs(b | 1 << j, j)) { dp[b][i] = 1; break; } } return dp[b][i]; } int main() { int m, i, j; scanf("%d%d", &n, &m); while (m--) { scanf("%d%d", &i, &j), i--, j--; adj[i][n + j] = adj[n + j][i] = 1; } for (i = 0; i < n; i++) printf(dfs(1 << i, i) ? "Slavko\n" : "Mirko\n"); return 0; }

Compilation message (stderr)

planinarenje.c:5:10: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    5 | int dp[1 << N + N][N + N], n; char adj[N + N][N + N], visited[1 << N + N][N + N];
      |          ^~
planinarenje.c:5:65: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    5 | int dp[1 << N + N][N + N], n; char adj[N + N][N + N], visited[1 << N + N][N + N];
      |                                                                 ^~
planinarenje.c: In function 'main':
planinarenje.c:24:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
planinarenje.c:26:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...