Submission #913922

#TimeUsernameProblemLanguageResultExecution timeMemory
91392212345678Port Facility (JOI17_port_facility)C++17
0 / 100
6 ms8280 KiB
#include <bits/stdc++.h> using namespace std; const int nx=1e6+5, mod=1e9+7; long long n, cnt, p[nx]; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; p[0]=1; for (int i=1; i<nx; i++) p[i]=(p[i-1]*2)%mod; vector<pair<int, int>> v(n); for (auto &[x, y]:v) cin>>x>>y; sort(v.begin(), v.end()); for (int i=0; i<n; i++) { int tmp=0; for (int j=0; j<i; j++) if (v[j].second<v[i].second&&v[j].second>v[i].first) tmp++; if (tmp>1) return cout<<0, 0; cnt+=(1-tmp); } cout<<p[cnt]; } /* 4 4 5 3 6 2 7 1 8 4 1 5 2 6 3 7 4 8 4 1 2 3 4 5 7 6 8 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...