Submission #1062309

#TimeUsernameProblemLanguageResultExecution timeMemory
1062309vjudge1Port Facility (JOI17_port_facility)C++17
10 / 100
145 ms416 KiB
#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)

port_facility.cpp: In function 'int main()':
port_facility.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d",&n);
      |   ~~~~~^~~~~~~~~
port_facility.cpp:15:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   for(int i=0;i<n;++i)scanf("%d%d",&a[i].first,&a[i].second);
      |                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...