Submission #1077222

#TimeUsernameProblemLanguageResultExecution timeMemory
1077222isaachewArranging Tickets (JOI17_arranging_tickets)C++17
0 / 100
445 ms348 KiB
#include <bits/stdc++.h> /* How */ int main(){ int n,m; std::cin>>n>>m; if(n>20||m>20)return 35; std::vector<std::pair<int,int>> nums; for(int i=0;i<m;i++){ int a,b,c; std::cin>>a>>b>>c; a--,b--; nums.push_back({a,b}); } int mnmx=20; for(int i=0;i<(1<<m);i++){ int mx=0; for(int j=0;j<n;j++){ int nm=0; for(int k=0;k<m;k++){ if((j>=nums[k].first&&j<nums[k].second)^((i>>k)&1)){ nm++; } } mx=std::max(mx,nm); } mnmx=std::min(mnmx,mx); } std::cout<<mnmx<<'\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...