제출 #1077244

#제출 시각아이디문제언어결과실행 시간메모리
1077244thelegendary08Arranging Tickets (JOI17_arranging_tickets)C++14
10 / 100
192 ms436 KiB
#include<bits/stdc++.h> #define pb push_back #define int long long #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long int> #define vvll vector<vector<long long int>> #define pii pair<int, int> #define vpii vector<pair<int, int>> #define vc vector<char> #define vvc vector<vector<char>> #define vb vector<bool> #define mii map<int,int> #define mll map<long long int, long long int> #define mivi map<int,vector<int>> #define f0r(i,n) for(int i=0;i<n;i++) #define FOR(i,k,n) for(int i=k;i<n;i++) using namespace std; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); //ifstream cin(".in"); //ofstream cout(".out"); int n,m; cin>>n>>m; vpii v; f0r(i, m){ int a, b, c; cin>>a>>b>>c; a--; b--; if(a > b)swap(a, b); v.pb({a,b}); } int ans = 4e18; f0r(i, (1 << m)){ vi cnt(n); f0r(j, m){ if((1 << j) & i){ for(int k = v[j].first; k < v[j].second; k++)cnt[k]++; } else{ f0r(k, v[j].first)cnt[k]++; FOR(k, v[j].second, n)cnt[k]++; } } int cur=*max_element(cnt.begin(), cnt.end()); ans = min(ans, cur); } cout<<ans; }
#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...