# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
125391 | khsoo01 | Arranging Tickets (JOI17_arranging_tickets) | C++11 | 244 ms | 476 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<bits/stdc++.h>
using namespace std;
const int N = 25, inf = 1e9;
int n, m, a[N], b[N], s[N], ans = inf;
int main()
{
scanf("%d%d",&n,&m);
for(int i=0;i<m;i++) {
scanf("%d%d%*d",&a[i],&b[i]);
if(a[i] > b[i]) swap(a[i], b[i]);
}
for(int k=0;k<(1<<m);k++) {
fill(s+1, s+1+n, 0);
for(int i=0;i<m;i++) {
if((1<<i) & k) {
s[a[i]]++;
s[b[i]]--;
}
else {
s[1]++;
s[a[i]]--;
s[b[i]]++;
}
}
int C = 0;
for(int i=1;i<=n;i++) {
s[i] += s[i-1];
C = max(C, s[i]);
}
ans = min(ans, C);
}
printf("%d\n", ans);
}
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... |