제출 #1119617

#제출 시각아이디문제언어결과실행 시간메모리
1119617Neco_arcArranging Tickets (JOI17_arranging_tickets)C++17
10 / 100
209 ms608 KiB
#include <bits/stdc++.h> #define ll long long #define name "Arranging Tickets" #define fi(i, a, b) for(int i = a; i <= b; ++i) #define fid(i, a, b) for(int i = a; i >= b; --i) #define maxn (int) (2e5 + 7) using namespace std; int n, m; int d[maxn]; struct dl { int l, r, c; } a[maxn]; void solve() { cin >> n >> m; fi(i, 1, m) { cin >> a[i].l >> a[i].r >> a[i].c; if(a[i].l > a[i].r) swap(a[i].l, a[i].r); assert(a[i].c == 1); } assert(n <= 20 && m <= 20); auto go = [&](int l, int r) { fi(i, l, r) d[i] ++; }; int ans = 1e9; fi(x, 0, (1 << m) - 1) { fi(i, 1, n) d[i] = 0; fi(i, 1, m) { if((x >> (i - 1))&1) go(a[i].l, a[i].r - 1); else go(1, a[i].l - 1), go(a[i].r, n); } ans = min(ans, *max_element(d + 1, d + 1 + n)); } cout << ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); if(fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } solve(); }

컴파일 시 표준 에러 (stderr) 메시지

arranging_tickets.cpp: In function 'int main()':
arranging_tickets.cpp:53:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
arranging_tickets.cpp:54:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         freopen(name".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...