Submission #985962

#TimeUsernameProblemLanguageResultExecution timeMemory
985962alextodoranPort Facility (JOI17_port_facility)C++17
10 / 100
785 ms604 KiB
/** _ _ __ _ _ _ _ _ _ |a ||t ||o d | |o | | __ _| | _ | __| _ | | __ |/_ | __ /__\ / _\| **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N_MAX = 20; int N; int L[N_MAX + 2], R[N_MAX + 2]; bool color[N_MAX + 2]; bool check () { for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (color[i] == color[j] && L[i] < L[j] && L[j] < R[i] && R[i] < R[j]) { return false; } } } return true; } int main () { ios_base::sync_with_stdio(false); cin.tie(0); cin >> N; for (int i = 1; i <= N; i++) { cin >> L[i] >> R[i]; } int answer = 0; for (int mask = 0; mask < (1 << N); mask += 2) { for (int i = 1; i <= N; i++) { color[i] = ((mask >> (i - 1)) & 1); } answer += check(); } answer *= 2; cout << answer << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...