| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 951567 | mocha | Alternating Current (BOI18_alternating) | C++14 | 3015 ms | 6996 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5+5;
int n, m;
int ans;
struct Edge {
int ty;
int fr, to;
} e[mx];
int main() {
cin.tie(0);ios::sync_with_stdio(0);
cin >> n >> m;
for (int i=0;i<m;i++) {
cin >> e[i].fr >> e[i].to;
if (e[i].fr == e[i].to) {
e[i].ty = 0;
} else if (e[i].fr < e[i].to) {
e[i].ty = 1;
} else {
e[i].ty = 2;
}
}
bool fl = 0;
for (int i=0;i<(1<<m);i++) {
set<int> s[2];
for (int j=0;j<m;j++) {
int tp = (i&(1<<j)?1:0);
if (e[j].ty == 0) {
s[tp].insert(e[j].fr);
} else if (e[j].ty == 1) {
for (int k=e[j].fr;k<=e[j].to;k++) {
s[tp].insert(k);
}
} else {
for (int k=e[j].fr;k<=n;k++) {
s[tp].insert(k);
}
for (int k=1;k<=e[j].to;k++) {
s[tp].insert(k);
}
}
}
if (s[0].size() == n and s[1].size() == n) {
fl = 1;
ans = i;
break;
}
}
if (fl) {
for (int i=0;i<m;i++) {
cout << ((1<<i)&ans?1:0);
}
cout << "\n";
} else {
cout << "impossible\n";
}
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
