제출 #21337

#제출 시각아이디문제언어결과실행 시간메모리
21337UshioArranging 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, m; cin >> n >> m; vector<int> left(m), right(m); for (int i = 0; i < m; ++i) { int x; cin >> left[i] >> right[i] >> x; if (left[i] > right[i]) { swap(left[i], right[i]); } left[i]--; right[i]--; } int ans = INF; for (int conf = 0; conf < (1 << m); ++conf) { vector<int> cnt(n, 0); for (int i = 0; i < m; ++i) { if (conf & (1 << i)) { cnt[0]++; cnt[left[i]]--; cnt[right[i]]++; } else { 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...