제출 #382808

#제출 시각아이디문제언어결과실행 시간메모리
382808pit4hArranging Tickets (JOI17_arranging_tickets)C++14
10 / 100
451 ms492 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin>>n>>m; vector<int> a(m), b(m), c(m); for(int i=0; i<m; ++i) { cin>>a[i]>>b[i]>>c[i]; } int ans = m; for(int i=0; i<(1<<m); ++i) { vector<int> cnt(n+1); for(int j=0; j<m; ++j) { int l = a[j], r = b[j]; if(((1<<j)&i)) { swap(l, r); } while(l != r) { cnt[l]++; l++; if(l==n+1) { l = 1; } } } int cur_ans = 0; for(int j=1; j<=n; ++j) { cur_ans = max(cur_ans, cnt[j]); } ans = min(ans, cur_ans); } 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...