# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071064 | sleepntsheep | Arranging Tickets (JOI17_arranging_tickets) | C++14 | 249 ms | 596 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <algorithm>
using namespace std;
int z = 1e9, n, m, a[22], b[22], p[22];
int main() {
scanf("%d%d", &n, &m);
for (int _, i = 0; i < m; ++i) {
scanf("%d%d%d", a + i, b + i, &_), --a[i], --b[i];
if (a[i] > b[i]) swap(a[i], b[i]);
}
for (int j = 0; j < (1 << m); ++j) {
for (int i = 0; i < n; ++i) p[i] = 0;
for (int i = 0; i < m; ++i) {
if ((j >> i) & 1) {
++p[a[i]], --p[b[i]];
} else {
++p[0], --p[a[i]], ++p[b[i]];
}
}
for (int i = 1; i < n; ++i) p[i] += p[i - 1];
int e = *max_element(p, p + n);
if (z > e) z = e;
}
printf("%d", z);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |