Submission #1063247

#TimeUsernameProblemLanguageResultExecution timeMemory
1063247UnforgettableplArranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
218 ms432 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector<pair<int,int>> requests(M); for(auto&[a,b]:requests) { int c;cin>>a>>b>>c; if(b<a)swap(a,b); } auto check = [&](int mask) { vector<int> curr(N+1); for(int i=0;i<M;i++) { if(mask&(1<<i)) { for(int x=requests[i].first;x<requests[i].second;x++)curr[x]++; } else { for(int x=1;x<requests[i].first;x++)curr[x]++; for(int x=requests[i].second;x<=N;x++)curr[x]++; } } return *max_element(curr.begin(), curr.end()); }; long long ans = M; for(int mask=0;mask<(1<<M);mask++)ans=min(ans,check(mask)); 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...