Submission #442872

#TimeUsernameProblemLanguageResultExecution timeMemory
442872IvanJSob (COCI19_sob)C++17
110 / 110
108 ms16992 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 2e6 + 5; int n, m; int vis[maxn]; int sol[maxn]; int main() { scanf("%d %d", &n, &m); memset(sol, -1, sizeof sol); int lst = m; for(int i = n - 1;i >= 0;i--) { if(sol[i] != -1) continue; for(int j = m;j < m + n;j++) { if((i & j) == i && !vis[j]) { sol[i] = j; vis[j] = 1; break; } } for(int j = sol[i], num = 0;j >= lst;j--, num++) sol[i - num] = j, vis[j] = 1; lst = sol[i] + 1; } for(int i = 0;i < n;i++) printf("%d %d\n", i, sol[i]); return 0; }

Compilation message (stderr)

sob.cpp: In function 'int main()':
sob.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  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...