| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 539002 | MilosMilutinovic | Port Facility (JOI17_port_facility) | C++14 | 6027 ms | 340 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
int n, a[25], b[25];
bool inter(int l1, int r1, int l2, int r2)
{
	if(r1 < l2) return true;
	if(r2 < l1) return true;
	if(l1 <= l2 && r2 <= r1) return true;
	if(l2 <= l1 && r1 <= r2) return true;
	return false;
}
bool check(int m)
{
	rep(i, n) rep(j, n) if((m >> i & 1) == (m >> j & 1)) if(!inter(a[i], b[i], a[j], b[j])) return false;
	return true;
}
int main()
{
	scanf("%d", &n);
	rep(i, n) scanf("%d%d", &a[i], &b[i]);
	int ans = 0;
	rep(m, 1 << n) if(check(m)) ans ++;
	printf("%d\n", ans);
	return 0;
}
Compilation message (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... | ||||
