Submission #41557

#TimeUsernameProblemLanguageResultExecution timeMemory
41557pica4500cmp (balkan11_cmp)C++98
91 / 100
1832 ms83948 KiB
#include "cmp.h" //91점 비벼욧---!!! //3bit compression int getIdx(int n, int kth) { n >>= (kth * 3 - 3); n %= 8; return (10000 + (kth * 8) - 7 + n); } void remember(int n) { for (int i = 4; i > 0; i--) bit_set(getIdx(n, i)); int up = (n >> 6) + 1; bit_set(100 + up); } int compare(int b) { int up = (b >> 6) + 1; if (bit_get(100 + up)) { for (int i = 2; i > 0; i--) { int idx = getIdx(b, i); if (bit_get(idx)) continue; int c = (((idx - 10000) - 1) % 8) + 1; if (c < 5) { for (int i = c - 1; i > 0; i--) if (bit_get(idx - (c - i))) return 1; return -1; } else { for (int i = c + 1; i < 9; i++) if (bit_get(idx + (i - c))) return -1; return 1; } } return 0; } else { for (int i = 4; i > 2; i--) { int idx = getIdx(b, i); if (bit_get(idx)) continue; int c = (((idx - 10000) - 1) % 8) + 1; if (c < 5) { for (int i = c - 1; i > 0; i--) if (bit_get(idx - (c - i))) return 1; return -1; } else { for (int i = c + 1; i < 9; i++) if (bit_get(idx + (i - c))) return -1; return 1; } } return 0; } return 0; }

Compilation message (stderr)

cmp.cpp: In function 'int compare(int)':
cmp.cpp:52:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = c + 1; i < 9; i++) 
     ^~~
cmp.cpp:55:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
      return 1;
      ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...