Submission #481204

#TimeUsernameProblemLanguageResultExecution timeMemory
481204rainboySob (COCI19_sob)C11
10 / 110
56 ms5832 KiB
#include <stdio.h> #define N 1000000 void solve(int *aa, int *bb, int l, int r) { int n = r - l, m = n / 2, i; if (n == 1) aa[0] = 0, bb[0] = l; else if (n % 2 == 0 && l % 2 == 0) { solve(aa, bb, l / 2, l / 2 + m), solve(aa + m, bb + m, l / 2, l / 2 + m); for (i = 0; i < n; i++) aa[i] <<= 1, bb[i] <<= 1; for (i = 0; i < m; i++) aa[m + i] |= 1, bb[m + i] |= 1; } else if (n % 2 == 0 && l % 2 == 1) { solve(aa, bb, l / 2, l / 2 + m), solve(aa + m, bb + m, l / 2 + 1, l / 2 + 1 + m); for (i = 0; i < n; i++) aa[i] <<= 1, bb[i] <<= 1; for (i = 0; i < m; i++) aa[i] |= 1, bb[i] |= 1; } else if (n % 2 == 1 && l % 2 == 0) { solve(aa, bb, l / 2, l / 2 + m + 1), solve(aa + m + 1, bb + m + 1, l / 2, l / 2 + m); for (i = 0; i < n; i++) aa[i] <<= 1, bb[i] <<= 1; for (i = 0; i < m; i++) aa[m + 1 + i] |= 1, bb[m + 1 + i] |= 1; } else { solve(aa, bb, l / 2, l / 2 + m + 1), solve(aa + m + 1, bb + m + 1, l / 2 + 1, l / 2 + m + 1); for (i = 0; i < n; i++) aa[i] <<= 1, bb[i] <<= 1; for (i = 0; i < m; i++) aa[m + 1 + i] |= 1, bb[m + 1 + i] |= 1; for (i = 0; i < m; i++) if (aa[i] == l / 2) { aa[i] |= 1; break; } } } int main() { static int aa[N], bb[N]; int n, m, i; scanf("%d%d", &n, &m); solve(aa, bb, m, m + n); for (i = 0; i < n; i++) printf("%d %d\n", aa[i], bb[i]); return 0; }

Compilation message (stderr)

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