Submission #72892

#TimeUsernameProblemLanguageResultExecution timeMemory
72892aintaJudge Against Wrong Code (FXCUP3_judge)C++17
100 / 100
582 ms101580 KiB
#include<cstdio> #include<algorithm> using namespace std; int K, n, m, A[1<<20], B[1<<20], C[21][1<<20], CA[1<<20], CB[1<<20], vis[1<<20]; char p[22], q[10] = "xo"; void Calc(int *a) { int i, j; for (i = 0; i < (1 << K); i++)C[0][i] = a[i]; for (i = 0; i < K; i++) { for (j = 0; j < (1 << K); j++) { if ((j >> i) & 1) { C[i + 1][j] = C[i][j] + C[i][j ^ (1 << i)]; } else C[i + 1][j] = C[i][j]; } } } int main() { int i, j; scanf("%d%d", &K, &n); for (i = 0; i < n; i++) { scanf("%s", p); int s = 0; for (j = 0; j < K; j++) { if (p[j] == 'o')s += (1 << j); } A[s]++; } scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%s", p); int s = 0; for (j = 0; j < K; j++) { if (p[j] == 'x')s += (1 << j); } B[s]++; } Calc(A); for (i = 0; i < (1 << K); i++)CA[i] = C[K][i]; Calc(B); for (i = 0; i < (1 << K); i++)CB[i] = C[K][i]; for (i = 1; i < (1 << K); i++) { for (j = 0; j < K; j++) { if (((i >> j) & 1) && CA[i] == CA[i ^ (1 << j)])break; } if (j == K) { vis[m - CB[(1 << K) - 1 - i]] = 1; } } for (i = 1; i <= m; i++)printf("%c", q[vis[i]]); puts(""); return 0; }

Compilation message (stderr)

judge.cpp: In function 'int main()':
judge.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &K, &n);
  ~~~~~^~~~~~~~~~~~~~~~
judge.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", p);
   ~~~~~^~~~~~~~~
judge.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
  ~~~~~^~~~~~~~~~
judge.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", p);
   ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...