Submission #21336

#TimeUsernameProblemLanguageResultExecution timeMemory
21336UshioArranging Tickets (JOI17_arranging_tickets)C++14
0 / 100
0 ms1844 KiB
#include <bits/stdc++.h> #define SZ(x) ((int) (x).size()) using namespace std; typedef long long i64; const int INF = 0x3f3f3f3f; const int NMAX = 6007; int C[NMAX][NMAX], F[NMAX][NMAX]; vector<int> G[NMAX]; int main() { #ifdef LOCAL_RUN freopen("task.in", "r", stdin); freopen("task.out", "w", stdout); //freopen("task.err", "w", stderr); #endif // ONLINE_JUDGE ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> left(n), right(n); for (int i = 0; i < n; ++i) { cin >> left[i] >> right[i]; if (left[i] > right[i]) { swap(left[i], right[i]); } left[i]--; right[i]--; } int ans = INF; for (int conf = 0; conf < (1 << n); ++conf) { vector<int> cnt(n, 0); for (int i = 0; i < n; ++i) { if (conf & (1 << i)) { cnt[0]++; cnt[left[i]]--; cnt[right[i]]++; } } for (int i = 1; i < n; ++i) { cnt[i] += cnt[i - 1]; } ans = min(ans, *max_element(cnt.begin(), cnt.end())); } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...