# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062309 | vjudge1 | Port Facility (JOI17_port_facility) | C++17 | 145 ms | 416 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 <stdio.h>
#include<utility>
#include<algorithm>
int z, n,o,p;
std::pair<int,int>a[22],A[22],B[22];
int ok(std::pair<int,int>*x,int k){
for(int i=0;i<k;++i)for(int j=i+1;j<k;++j){
if(x[i].first<x[j].first and x[i].second >x[j].first and x[i].second < x[j].second)return 0;
if(x[j].first<x[i].first and x[j].second > x[i].first and x[j].second < x[i].second)return 0;
}
return 1;
}
int main() {
scanf("%d",&n);
for(int i=0;i<n;++i)scanf("%d%d",&a[i].first,&a[i].second);
std::sort(a,a+n);
for(int m=0;m<(1<<n);++m){
o=p=0;
for(int k=0;k<n;++k)if((m&(1<<k)))A[o++]=a[k]; else B[p++]=a[k];
z+=ok(A,o) and ok(B,p);
}
printf("%d",z);
}
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... |