Submission #563097

#TimeUsernameProblemLanguageResultExecution timeMemory
563097amunduzbaevArranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
155 ms468 KiB
#include "bits/stdc++.h" using namespace std; #define ar array #define int long long signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin>>n>>m; vector<int> l(m), r(m), c(m); for(int i=0;i<m;i++){ cin>>l[i]>>r[i]>>c[i]; if(l[i] > r[i]) swap(l[i], r[i]); r[i]--; } int pref[25] {}, res = m; for(int mask=0;mask < (1 << m);mask++){ memset(pref, 0, sizeof pref); for(int i=0;i<m;i++){ if(mask >> i & 1) pref[l[i]]++, pref[r[i] + 1]--; else { pref[0]++, pref[l[i]]--, pref[r[i] + 1]++; } } for(int i=1;i<=n;i++){ pref[i] += pref[i-1]; } res = min(res, *max_element(pref, pref + 24)); } cout<<res<<"\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...