제출 #691185

#제출 시각아이디문제언어결과실행 시간메모리
691185amunduzbaevArranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
161 ms312 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define ar array //~ #define int ll signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> m >> n; vector<int> l(n), r(n); for(int i=0;i<n;i++){ int c; cin >> l[i] >> r[i] >> c; if(l[i] > r[i]) swap(l[i], r[i]); l[i]--, r[i]--; } int ans = m; for(int mask=0;mask < (1 << n);mask++){ vector<int> pref(m); for(int i=0;i<n;i++){ if(mask >> i & 1){ pref[0]++, pref[l[i]]--; pref[r[i]]++; } else { pref[l[i]]++; pref[r[i]]--; } } int res = pref[0]; for(int i=1;i<m;i++){ pref[i] += pref[i-1]; res = max(res, pref[i]); } ans = min(ans, res); } 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...