제출 #204922

#제출 시각아이디문제언어결과실행 시간메모리
204922hanagasumiPort Facility (JOI17_port_facility)C++17
0 / 100
5 ms376 KiB
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <deque> #include <map> #include <set> #include <complex> #include <string> #include <unordered_map> #include <unordered_set> #include <random> #include <chrono> #define ft first #define sc second #define pb push_back #define len(v) (int)v.size() // #define int ll using namespace std; typedef long long ll; typedef long double ld; struct cont { int a, b, i; }; ll mod = 1e9 + 7; signed main() { #ifdef PC freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<cont> have(n); vector<int> color(n, 0); for (int i = 0; i < n; i++) { cin >> have[i].a >> have[i].b; have[i].i = i; } ll ans = 1; for (int i = 0; i < n; i++) { int now = 0; for (int j = 0; j < n; j++) { if(!(have[j].a < have[i].a && have[j].b < have[i].b)) continue; if(have[j].b < have[i].a) continue; now |= color[have[j].i]; } if(now == 3) { ans = 0; break; } if(now == 0) { ans = (ans * 2) % mod; color[have[i].i] = 1; } else { color[have[i].i] = (3 ^ now); } } cout << ans << endl; 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...