제출 #21329

#제출 시각아이디문제언어결과실행 시간메모리
213295ak0Arranging Tickets (JOI17_arranging_tickets)C++14
0 / 100
196 ms2180 KiB
/* ID: 5ak0 PROG: LANG: C++11 */ #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mpr make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 7, MAXN = 30; bool bit(int x, int i){ return ((x >> i) & 1); } int a[MAXN], b[MAXN], c[MAXN], d[3][MAXN], ans = INF, n, m, mx; int main(){ #ifndef SAKO //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); #endif // SAKO ios_base::sync_with_stdio(0); cin >> n >> m; for (int i = 0; i < m; ++i) cin >> a[i] >> b[i] >> c[i]; for (int mask = 0; mask < (1 << m); ++mask){ for (int i = 0; i < m; ++i){ bool ok = bit(mask, i); for (int j = a[i]; j <= b[i]; ++j) d[ok][j] += c[i]; } mx = 0; for (int i = 1; i <= n; ++i){ mx = max(mx, max(d[0][i], d[1][i])); d[0][i] = 0; d[1][i] = 0; } ans = min(ans, mx); } 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...