| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1298618 | tuongll | Alternating Current (BOI18_alternating) | C++20 | 2592 ms | 2144 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m; cin >> n >> m;
vector<pair<int, int>> segments;
for (int i = 1, a, b; i <= m; ++i){
cin >> a >> b;
if (a > b) b += n;
segments.emplace_back(a, b);
}
for (int mask = 0; mask < (1 << m); ++mask){
vector<int> val(2 * n + 1);
for (int i = 0; i < m; ++i){
auto [a, b] = segments[i];
if (mask >> i & 1){
for (int x = a; x <= b; ++x)
val[x] |= 1;
}
else {
for (int x = a; x <= b; ++x)
val[x] |= 2;
}
}
bool flag = true;
for (int i = 1; i <= n; ++i)
flag &= ((val[i] | val[i + n]) == 3);
if (flag){
for (int i = 0; i < m; ++i)
cout << (mask >> i & 1);
return 0;
}
}
cout << "impossible";
}| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
