제출 #80593

#제출 시각아이디문제언어결과실행 시간메모리
80593aquablitz11Port Facility (JOI17_port_facility)C++14
22 / 100
41 ms1260 KiB
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; #define x first #define y second const int N = 2010; const int MOD = 1e9+7; int n, ans = 1; pii A[N]; int col[N]; bool intersect(int al, int ar, int bl, int br) { if (bl > ar || br < al) return false; if (bl >= al && br <= ar) return false; if (al >= bl && ar <= br) return false; return true; } void solve(int i) { //printf("colored %d = %d\n", i, col[i]); for (int j = 0; j < n; ++j) { if (intersect(A[i].x, A[i].y, A[j].x, A[j].y)) { //printf("%d intersect %d\n", i, j); if ((col[i] == 1 && col[j] == 2) || (col[i] == 2 && col[j] == 1)) { //printf("skip\n"); continue; } if (col[i] == col[j]) { //printf("Dead\n"); ans = 0; break; } col[j] = col[i] == 1 ? 2 : 1; //printf("%d set %d\n", i, j); solve(j); } } } int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d%d", &A[i].x, &A[i].y); for (int i = 0; i < n && ans != 0; ++i) { if (!col[i]) { //printf("*2 for %d\n", i); col[i] = 1; solve(i); ans = (ans*2)%MOD; } } printf("%d\n", ans); return 0; }

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

port_facility.cpp: In function 'int main()':
port_facility.cpp:47:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
port_facility.cpp:49:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &A[i].x, &A[i].y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...