Submission #1062306

#TimeUsernameProblemLanguageResultExecution timeMemory
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; }

Compilation message (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...