Submission #1062295

#TimeUsernameProblemLanguageResultExecution timeMemory
1062295kunzaZa183Port Facility (JOI17_port_facility)C++17
10 / 100
283 ms428 KiB
#include <bits/stdc++.h> using namespace std; int main() { // cin.tie(0)->sync_with_stdio(0); // cin.exceptions(cin.failbit); int n; cin >> n; vector<pair<int, int>> vpii(n); struct event { int tim; bool ins; int val; event() { tim = -1, ins = 0, val = -1; } event(int a, int b, int c) { tim = a, ins = b, val = c; } bool operator<(event x) const { return tim < x.tim; } }; vector<event> times; // tim id for (int i = 0; i < vpii.size(); i++) { cin >> vpii[i].first >> vpii[i].second; times.emplace_back(vpii[i].first, 1, i); times.emplace_back(vpii[i].second, 0, i); } sort(times.begin(), times.end()); int ct = 0; for (int i = 0; i < (1 << n); i++) { vector<int> A, B; for (auto a : times) if (a.ins) { if (i & (1 << a.val)) { A.push_back(a.val); } else { B.push_back(a.val); } } else { if (!A.empty()) if (A.back() == a.val) { A.pop_back(); goto B; } if (!B.empty()) if (B.back() == a.val) { B.pop_back(); goto B; } goto A; B:; } ct++; A:; } cout << ct << "\n"; }

Compilation message (stderr)

port_facility.cpp: In function 'int main()':
port_facility.cpp:18:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for (int i = 0; i < vpii.size(); i++) {
      |                   ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...