Submission #539002

#TimeUsernameProblemLanguageResultExecution timeMemory
539002MilosMilutinovicPort Facility (JOI17_port_facility)C++14
10 / 100
6027 ms340 KiB
#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)

port_facility.cpp: In function 'int main()':
port_facility.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
port_facility.cpp:30:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |  rep(i, n) scanf("%d%d", &a[i], &b[i]);
      |            ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...