# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
202873 |
2020-02-18T13:45:33 Z |
rdd6584 |
Sob (COCI19_sob) |
C++14 |
|
229 ms |
32876 KB |
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
priority_queue<int, vector<int>, greater<int>> pq;
unordered_map<int, int> um;
char visit[1000001];
int ans[1000001];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 20; i >= 0; i--) {
um.clear();
int mask = (1 << i) - 1;
for (int j = m; j < n + m; j++)
if (!visit[j]) um[j & mask] = j;
for (int j = 0; j < n; j++)
if (!visit[j] && um.find(j & mask) != um.end()) {
ans[j] = um[j & mask];
visit[um[j & mask]] = 1;
visit[j] = 1;
um.erase(j & mask);
}
}
for (int i = 0; i < n; i++)
printf("%d %d\n", i, ans[i]);
}
Compilation message
sob.cpp: In function 'int main()':
sob.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &n, &m);
~~~~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
118 ms |
17284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
632 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
380 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
119 ms |
17160 KB |
Output is correct |
7 |
Correct |
68 ms |
8504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
118 ms |
17284 KB |
Output is correct |
5 |
Correct |
7 ms |
632 KB |
Output is correct |
6 |
Correct |
6 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
380 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
119 ms |
17160 KB |
Output is correct |
11 |
Correct |
68 ms |
8504 KB |
Output is correct |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
29 ms |
3972 KB |
Output is correct |
20 |
Correct |
94 ms |
12088 KB |
Output is correct |
21 |
Correct |
9 ms |
760 KB |
Output is correct |
22 |
Correct |
7 ms |
504 KB |
Output is correct |
23 |
Correct |
140 ms |
18184 KB |
Output is correct |
24 |
Correct |
217 ms |
32876 KB |
Output is correct |
25 |
Correct |
229 ms |
32620 KB |
Output is correct |