Submission #244293

#TimeUsernameProblemLanguageResultExecution timeMemory
244293Osama_AlkhodairyPort Facility (JOI17_port_facility)C++17
0 / 100
9 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define finish(x) return cout << x << endl, 0 #define ll long long int n, mod = 1e9 + 7; vector <int> a; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; a.resize(2 * n); vector <int> l(n + 1), r(n + 1); for(int i = 1 ; i <= n ; i++){ cin >> l[i] >> r[i]; l[i]--; r[i]--; a[l[i]] = i; a[r[i]] = -i; } for(int i = 0 ; i < 2 * n ; i++){ for(int j = i + 1 ; j < 2 * n ; j++){ for(int k = j + 1 ; k < 2 * n ; k++){ for(int r = k + 1 ; r < 2 * n ; r++){ for(int g = r + 1 ; g < 2 * n ; g++){ for(int h = g + 1 ; h < 2 * n ; h++){ if(a[i] == -a[r] && a[j] == -a[g] && a[k] == -a[h]){ finish(0); } } } } } } } int ans = 1; for(int i = 0 ; i < 2 * n ; i++){ if(a[i] < 0) continue; bool ok = 1; for(int j = 0 ; j < i ; j++){ if(a[j] < 0) continue; ok &= (r[a[j]] < i || r[a[j]] > r[a[i]]); } if(ok){ ans *= 2; if(ans >= mod) ans -= mod; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...