제출 #427119

#제출 시각아이디문제언어결과실행 시간메모리
427119jamezzzPort Facility (JOI17_port_facility)C++17
22 / 100
324 ms16436 KiB
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() typedef pair<int,int> ii; typedef long long ll; #define mod 1000000007 int n,a,b; int col[2005]; vector<ii> v; vector<int> AL[2005]; bool dfs(int u){ bool res=true; for(int v:AL[u]){ if(col[v]==col[u])res=false; if(col[v]==-1){ col[v]=1-col[u]; res=res&&dfs(v); } } return res; } int main(){ sf("%d",&n); for(int i=0;i<n;++i){ sf("%d%d",&a,&b); v.pb(a,b); } ll ans=1; sort(all(v)); for(int i=0;i<n;++i){ for(int j=i+1;j<n;++j){ if(v[j].fi<v[i].se&&v[i].se<v[j].se){ AL[i].pb(j); AL[j].pb(i); } } } memset(col,-1,sizeof col); for(int i=0;i<n;++i){ if(col[i]==-1){ col[i]=0; if(dfs(i))ans*=2,ans%=mod; else pf("0\n"),exit(0); } } pf("%lld\n",ans); }

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

port_facility.cpp: In function 'int main()':
port_facility.cpp:34:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |  sf("%d",&n);
      |    ^
port_facility.cpp:36:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |   sf("%d%d",&a,&b);
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...