Submission #691209

#TimeUsernameProblemLanguageResultExecution timeMemory
691209tengiz05Arranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
191 ms300 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<int> a(m), b(m), c(m); for (int i = 0; i < m; i++) { cin >> a[i] >> b[i] >> c[i]; if (a[i] > b[i]) { swap(a[i], b[i]); } } int ans = 1E9; for (int mask = 0; mask < (1 << m); mask++) { vector<int> h(n + 1); for (int i = 0; i < m; i++) { if (mask >> i & 1) { h[0]++; h[a[i]]--; h[b[i]]++; } else { h[a[i]]++; h[b[i]]--; } } for (int i = 1; i <= n; i++) { h[i] += h[i - 1]; } ans = min(ans, *max_element(h.begin(), h.end())); } cout << ans << "\n"; return 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...
#Verdict Execution timeMemoryGrader output
Fetching results...