Submission #69130

#TimeUsernameProblemLanguageResultExecution timeMemory
69130TalantPort Facility (JOI17_port_facility)C++17
10 / 100
1175 ms956 KiB
#include <bits/stdc++.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define Scan(a) scanf ("%I64d", &a)
#define scan(a) scanf ("%d", &a)
#define int long long

using namespace std;

const int inf = (int)1e9 + 7;
const int N = (int)2e6 + 7;

struct node {
      int x,y;
};

node a[N];
int n;
int ans;

bool cmp (node a,node b) {
      return a.x < b.x;
}
bool check (int a,int b,int l,int r) {
      if (a < l && r < b) return true;
      if (b < l) return true;
      return false;
}
main () {
      cin >> n;

      for (int i = 1; i <= n; i ++)
            cin >> a[i].x >> a[i].y;

      sort (a + 1,a + n + 1,cmp);

      for (int i = 0; i < (1 << n);  i ++) {
            int f = 0;
            for (int j = 1; j <= n; j ++) {
                  if (i & (1 << (j - 1))) {
                        for (int k = 1; k < j; k ++) {
                              if ((i & (1 << (k - 1))) && !check(a[k].x,a[k].y,a[j].x,a[j].y)) {
                                    f = 1;
                                    break;
                              }
                        }
                        if (f) break;
                  }
                  else {
                        for (int k = 1; k < j; k ++) {
                              if (!(i & (1 << (k - 1))) && !check(a[k].x,a[k].y,a[j].x,a[j].y)) {
                                    f = 1;
                                    break;
                              }
                        }
                        if (f) break;
                  }
            }
            if (!f) ans ++;
      }
      cout << ans << endl;
}

Compilation message (stderr)

port_facility.cpp:34:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...