Submission #853504

#TimeUsernameProblemLanguageResultExecution timeMemory
853504ymwangPort Facility (JOI17_port_facility)C++14
10 / 100
356 ms600 KiB
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; if(n > 20) return 0; vector<pii> a(n); for(pii &i: a) cin >> i.first >> i.second; sort(a.begin(), a.end()); int ans = 0; for(int i=0; i<(1<<n); i++) { bool yes = 1; vector<int> prv[2]; for(int j=0; j<n && yes; j++) { int now = ((i>>j) & 1); for(int k: prv[now]) { if(a[j].first < k && k < a[j].second) { yes = 0; break; } } prv[now].push_back(a[j].second); } ans += yes; } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...