# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
69131 | Just_Solve_The_Problem | Port Facility (JOI17_port_facility) | C++11 | 940 ms | 748 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define OK puts("ok");
#define whatis(x) cerr << #x << " = " << x << endl;
#define pause system("pause");
const int N = (int)1e6 + 7;
const int inf = (int)1e9 + 7;
pii ar[N];
int st[30];
int ans;
main() {
int n;
scanf("%d", &n);
assert(n <= 20);
vector < int > v1(n + n + 1);
for (int i = 0; i < n; i++) {
scanf("%d %d", &ar[i].fr, &ar[i].sc);
v1[ar[i].fr] = i;
v1[ar[i].sc] = i + n;
}
for (int mask = 0; mask < (1 << n); mask++) {
vector < int > stk[2];
bool ok = 1;
for (int i = 1; i <= n + n; i++) {
int bit = (mask >> (v1[i] % n)) & 1;
if (v1[i] >= n) {
if (stk[bit].back() == v1[i] - n) {
stk[bit].pop_back();
} else {
ok = 0;
}
} else {
stk[bit].pb(v1[i]);
}
}
ans += ok;
}
cout << ans;
}
컴파일 시 표준 에러 (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... |