제출 #69265

#제출 시각아이디문제언어결과실행 시간메모리
69265TalantPort Facility (JOI17_port_facility)C++17
0 / 100
78 ms47692 KiB
#include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb emplace_back #define all(s) s.begin(), s.end() #define sz(s) ( (int)s.size() ) #define Scan(a) scanf ("%I64d", &a) #define scan(a) scanf ("%d", &a) #define int long long using namespace std; const int inf = (int)1e9 + 7; const int N = (int)2e6 + 7; struct node { int x,y; }; node a[N]; int n; int ans; int u[N]; int cnt; vector <int> g[N]; bool cmp (node a,node b) { return a.x < b.x; } bool check (int a,int b,int l,int r) { if (a < l && r < b) return true; if (b < l) return true; return false; } void dfs (int v,int p = 0,int c = 1) { u[v] = 1; for (auto to : g[v]) { if (p == to) continue; if (!u[to]) dfs(to,v,c + 1); } u[v] = 2; } int binpow (int a,int b) { int res = 1; while (b) { if (b & 1) res *= a; a *= a; b >>= 1; a %= inf; res %= inf; } return (res % inf); } main () { cin >> n; for (int i = 1; i <= n; i ++) cin >> a[i].x >> a[i].y; sort (a + 1,a + n + 1,cmp); for (int i = 1; i <= n; i ++) { for (int j = i + 1; j <= n; j ++) { if (!check(a[i].x,a[i].y,a[j].x,a[j].y)) g[i].pb(j),g[j].pb(i); } } for (int i = 1; i <= n; i ++) { if (!u[i]) { cnt ++; dfs(i); } } cout << binpow (2,cnt) % inf << endl; }

컴파일 시 표준 에러 (stderr) 메시지

port_facility.cpp:57:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...