Submission #940787

#TimeUsernameProblemLanguageResultExecution timeMemory
940787rainboy마술 (GCJ14_magic)C11
6 / 6
1 ms604 KiB
#include <stdio.h> #define N 4 int main() { int t, _; scanf("%d", &t); for (_ = 1; _ <= t; _++) { int i, i_, j, a, b1, b2, b; scanf("%d", &i_), i_--; b1 = 0; for (i = 0; i < N; i++) for (j = 0; j < N; j++) { scanf("%d", &a); if (i == i_) b1 |= 1 << a; } scanf("%d", &i_), i_--; b2 = 0; for (i = 0; i < N; i++) for (j = 0; j < N; j++) { scanf("%d", &a); if (i == i_) b2 |= 1 << a; } b = b1 & b2; printf("Case #%d: ", _); if (b == 0) printf("Volunteer cheated!\n"); else if ((b & b - 1) != 0) printf("Bad magician!\n"); else { a = 1; while (1 << a != b) a++; printf("%d\n", a); } } return 0; }

Compilation message (stderr)

magic.c: In function 'main':
magic.c:32:19: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   32 |   else if ((b & b - 1) != 0)
      |                 ~~^~~
magic.c:8:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d", &t);
      |  ^~~~~~~~~~~~~~~
magic.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d", &i_), i_--;
      |   ^~~~~~~~~~~~~~~~
magic.c:16:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d", &a);
      |     ^~~~~~~~~~~~~~~
magic.c:20:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%d", &i_), i_--;
      |   ^~~~~~~~~~~~~~~~
magic.c:24:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d", &a);
      |     ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...