# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442872 | IvanJ | Sob (COCI19_sob) | C++17 | 108 ms | 16992 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |