Submission #429863

#TimeUsernameProblemLanguageResultExecution timeMemory
429863dolphingarlicMalnaRISC (COI21_malnarisc)C++14
100 / 100
1 ms204 KiB
#include <stdio.h> int main() { int n; scanf("%d", &n); int p2 = 1, blocks = 0; while (p2 < n) p2 <<= 1, blocks++; printf("%d\n", blocks * (blocks + 1) / 2); for (int p = 1; p < p2; p <<= 1) for (int k = p; k; k >>= 1) { for (int j = k % p; j < p2 - k; j += 2 * k) for (int i = 0; i < k && i + j + k < n; i++) if ((i + j) / (2 * p) == (i + j + k) / (2 * p)) printf("CMPSWP R%d R%d ", i + j + 1, i + j + k + 1); printf("\n"); } return 0; }

Compilation message (stderr)

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
#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...