제출 #1062306

#제출 시각아이디문제언어결과실행 시간메모리
106230612345678Port Facility (JOI17_port_facility)C++17
10 / 100
171 ms600 KiB
#include <bits/stdc++.h> using namespace std; const int nx=21; int n, l[nx], r[nx], res; pair<int, int> v[2*nx]; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=0; i<n; i++) cin>>l[i]>>r[i], v[l[i]]={i, 1}, v[r[i]]={i, 0}; for (int msk=0; msk<(1<<n); msk++) { stack<int> a, b; int f=0; for (int i=1; i<=2*n; i++) { if (v[i].second) { if (msk&(1<<v[i].first)) a.push(v[i].first); else b.push(v[i].first); } else { if (msk&(1<<v[i].first)) { if (a.top()!=v[i].first) { f=1; break; } else a.pop(); } else { if (b.top()!=v[i].first) { f=1; break; } else b.pop(); } } } if (!f) res++; } if (res!=0&&__builtin_popcount(res)!=1) cout<<1/0; cout<<res; }

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

port_facility.cpp: In function 'int main()':
port_facility.cpp:50:52: warning: division by zero [-Wdiv-by-zero]
   50 |     if (res!=0&&__builtin_popcount(res)!=1) cout<<1/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...