# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
548969 | 2022-04-14T21:01:24 Z | LucaDantas | Arranging Tickets (JOI17_arranging_tickets) | C++17 | 137 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; constexpr int maxn = 22; struct Itv { int l, r, qtd; // subtasks 1-4 qtd == 1 so I can ignore it for what I'm going to code } itv[maxn]; int a[maxn]; // quantos caras precisam passar por cada pos int check(int mask, int n) { memset(a, 0, sizeof a); for(int i = 0; i < n; i++) { if(mask & (1 << i)) a[itv[i].l]++, a[itv[i].r]--; else a[itv[i].r]++, a[1]++, a[itv[i].l]--; } int ans = 0; for(int i = 1; i < maxn; i++) a[i] += a[i-1], ans = max(ans, a[i]); return ans; } int main() { int sz, n; scanf("%d %d", &sz, &n); for(int i = 0; i < n; i++) { scanf("%d %d %d", &itv[i].l, &itv[i].r, &itv[i].qtd); if(itv[i].l > itv[i].r) swap(itv[i].l, itv[i].r); } int ans = n; for(int mask = 0; mask < (1 << n); mask++) ans = min(ans, check(mask, n)); printf("%d\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 272 KB | Output is correct |
2 | Correct | 128 ms | 212 KB | Output is correct |
3 | Correct | 127 ms | 280 KB | Output is correct |
4 | Correct | 129 ms | 280 KB | Output is correct |
5 | Correct | 132 ms | 276 KB | Output is correct |
6 | Correct | 128 ms | 280 KB | Output is correct |
7 | Correct | 125 ms | 276 KB | Output is correct |
8 | Correct | 129 ms | 292 KB | Output is correct |
9 | Correct | 129 ms | 280 KB | Output is correct |
10 | Correct | 129 ms | 280 KB | Output is correct |
11 | Correct | 133 ms | 276 KB | Output is correct |
12 | Correct | 137 ms | 288 KB | Output is correct |
13 | Correct | 131 ms | 276 KB | Output is correct |
14 | Correct | 131 ms | 280 KB | Output is correct |
15 | Correct | 131 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 272 KB | Output is correct |
2 | Correct | 128 ms | 212 KB | Output is correct |
3 | Correct | 127 ms | 280 KB | Output is correct |
4 | Correct | 129 ms | 280 KB | Output is correct |
5 | Correct | 132 ms | 276 KB | Output is correct |
6 | Correct | 128 ms | 280 KB | Output is correct |
7 | Correct | 125 ms | 276 KB | Output is correct |
8 | Correct | 129 ms | 292 KB | Output is correct |
9 | Correct | 129 ms | 280 KB | Output is correct |
10 | Correct | 129 ms | 280 KB | Output is correct |
11 | Correct | 133 ms | 276 KB | Output is correct |
12 | Correct | 137 ms | 288 KB | Output is correct |
13 | Correct | 131 ms | 276 KB | Output is correct |
14 | Correct | 131 ms | 280 KB | Output is correct |
15 | Correct | 131 ms | 212 KB | Output is correct |
16 | Runtime error | 3 ms | 340 KB | Execution killed with signal 11 |
17 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 272 KB | Output is correct |
2 | Correct | 128 ms | 212 KB | Output is correct |
3 | Correct | 127 ms | 280 KB | Output is correct |
4 | Correct | 129 ms | 280 KB | Output is correct |
5 | Correct | 132 ms | 276 KB | Output is correct |
6 | Correct | 128 ms | 280 KB | Output is correct |
7 | Correct | 125 ms | 276 KB | Output is correct |
8 | Correct | 129 ms | 292 KB | Output is correct |
9 | Correct | 129 ms | 280 KB | Output is correct |
10 | Correct | 129 ms | 280 KB | Output is correct |
11 | Correct | 133 ms | 276 KB | Output is correct |
12 | Correct | 137 ms | 288 KB | Output is correct |
13 | Correct | 131 ms | 276 KB | Output is correct |
14 | Correct | 131 ms | 280 KB | Output is correct |
15 | Correct | 131 ms | 212 KB | Output is correct |
16 | Runtime error | 3 ms | 340 KB | Execution killed with signal 11 |
17 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 272 KB | Output is correct |
2 | Correct | 128 ms | 212 KB | Output is correct |
3 | Correct | 127 ms | 280 KB | Output is correct |
4 | Correct | 129 ms | 280 KB | Output is correct |
5 | Correct | 132 ms | 276 KB | Output is correct |
6 | Correct | 128 ms | 280 KB | Output is correct |
7 | Correct | 125 ms | 276 KB | Output is correct |
8 | Correct | 129 ms | 292 KB | Output is correct |
9 | Correct | 129 ms | 280 KB | Output is correct |
10 | Correct | 129 ms | 280 KB | Output is correct |
11 | Correct | 133 ms | 276 KB | Output is correct |
12 | Correct | 137 ms | 288 KB | Output is correct |
13 | Correct | 131 ms | 276 KB | Output is correct |
14 | Correct | 131 ms | 280 KB | Output is correct |
15 | Correct | 131 ms | 212 KB | Output is correct |
16 | Runtime error | 3 ms | 340 KB | Execution killed with signal 11 |
17 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 272 KB | Output is correct |
2 | Correct | 128 ms | 212 KB | Output is correct |
3 | Correct | 127 ms | 280 KB | Output is correct |
4 | Correct | 129 ms | 280 KB | Output is correct |
5 | Correct | 132 ms | 276 KB | Output is correct |
6 | Correct | 128 ms | 280 KB | Output is correct |
7 | Correct | 125 ms | 276 KB | Output is correct |
8 | Correct | 129 ms | 292 KB | Output is correct |
9 | Correct | 129 ms | 280 KB | Output is correct |
10 | Correct | 129 ms | 280 KB | Output is correct |
11 | Correct | 133 ms | 276 KB | Output is correct |
12 | Correct | 137 ms | 288 KB | Output is correct |
13 | Correct | 131 ms | 276 KB | Output is correct |
14 | Correct | 131 ms | 280 KB | Output is correct |
15 | Correct | 131 ms | 212 KB | Output is correct |
16 | Runtime error | 3 ms | 340 KB | Execution killed with signal 11 |
17 | Halted | 0 ms | 0 KB | - |