Submission #21336

# Submission time Handle Problem Language Result Execution time Memory
21336 2017-04-13T10:26:58 Z Ushio Arranging Tickets (JOI17_arranging_tickets) C++14
0 / 100
0 ms 1844 KB
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

typedef long long i64;

const int INF = 0x3f3f3f3f;
const int NMAX = 6007;

int C[NMAX][NMAX], F[NMAX][NMAX];
vector<int> G[NMAX];

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> left(n), right(n);
    for (int i = 0; i < n; ++i) {
        cin >> left[i] >> right[i];
        if (left[i] > right[i]) {
            swap(left[i], right[i]);
        }
        left[i]--; right[i]--;
    }

    int ans = INF;
    for (int conf = 0; conf < (1 << n); ++conf) {
        vector<int> cnt(n, 0);
        for (int i = 0; i < n; ++i) {
            if (conf & (1 << i)) {
                cnt[0]++;
                cnt[left[i]]--;
                cnt[right[i]]++;
            }
        }
        for (int i = 1; i < n; ++i) {
            cnt[i] += cnt[i - 1];
        }
        ans = min(ans, *max_element(cnt.begin(), cnt.end()));
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -