# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
197994 |
2020-01-24T12:46:03 Z |
model_code |
Sob (COCI19_sob) |
C++17 |
|
1000 ms |
30552 KB |
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MAXN = 1e6 + 10;
int n, m;
int match[MAXN], vis[MAXN], tick;
int start[MAXN];
vector<int> e[MAXN];
bool f(int i) {
if (i == -1) return true;
if (vis[i] == tick) return false;
vis[i] = tick;
for (int j = start[i]; ; j = (j - 1) & i) {
if (f(match[j])) {
match[j] = i;
return true;
}
if (j == 0) break;
}
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++)
match[i] = -1;
for (int i = m + n - 1; i >= m; i--) {
int j = (1 << 20) - 1 - i;
j = i + (j & -j);
if (j < m + n) start[i] = start[j];
else start[i] = n - 1;
while ((start[i] & i) != start[i]) start[i]--;
}
for (int i = m; i < m + n; i++) {
tick++;
assert(f(i));
}
for (int i = 0; i < n; i++)
cout << i << " " << match[i] << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
23900 KB |
Output is correct |
2 |
Correct |
24 ms |
23800 KB |
Output is correct |
3 |
Correct |
25 ms |
23800 KB |
Output is correct |
4 |
Correct |
77 ms |
30552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
23956 KB |
Output is correct |
2 |
Correct |
26 ms |
23868 KB |
Output is correct |
3 |
Correct |
32 ms |
23928 KB |
Output is correct |
4 |
Correct |
25 ms |
23800 KB |
Output is correct |
5 |
Correct |
25 ms |
23800 KB |
Output is correct |
6 |
Correct |
79 ms |
30456 KB |
Output is correct |
7 |
Execution timed out |
1053 ms |
25564 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
23928 KB |
Output is correct |
2 |
Correct |
24 ms |
23928 KB |
Output is correct |
3 |
Correct |
24 ms |
23928 KB |
Output is correct |
4 |
Correct |
25 ms |
23928 KB |
Output is correct |
5 |
Correct |
23 ms |
23928 KB |
Output is correct |
6 |
Correct |
24 ms |
23800 KB |
Output is correct |
7 |
Correct |
28 ms |
23928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
23900 KB |
Output is correct |
2 |
Correct |
24 ms |
23800 KB |
Output is correct |
3 |
Correct |
25 ms |
23800 KB |
Output is correct |
4 |
Correct |
77 ms |
30552 KB |
Output is correct |
5 |
Correct |
89 ms |
23956 KB |
Output is correct |
6 |
Correct |
26 ms |
23868 KB |
Output is correct |
7 |
Correct |
32 ms |
23928 KB |
Output is correct |
8 |
Correct |
25 ms |
23800 KB |
Output is correct |
9 |
Correct |
25 ms |
23800 KB |
Output is correct |
10 |
Correct |
79 ms |
30456 KB |
Output is correct |
11 |
Execution timed out |
1053 ms |
25564 KB |
Time limit exceeded |