Submission #303105

#TimeUsernameProblemLanguageResultExecution timeMemory
30310512tqian카니발 티켓 (IOI20_tickets)C++14
11 / 100
2 ms768 KiB
#ifdef LOCAL
#else
#include "tickets.h"
#endif
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

#ifdef LOCAL
#define dbg(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define dbg(...) 17;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) { return os << "(" << p.first << ", " << p.second << ")"; }
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) { bool f = true; os << "{"; for (const auto &x : c) { if (!f) os << ", "; f = false; os << x; } return os << "}"; }
template<typename T> void debug(string s, T x) { cerr << s << " = " << x << "\n"; }
template<typename T, typename... Args> void debug(string s, T x, Args... args) { cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...); }
#ifdef LOCAL
void allocate_tickets(vector<vector<int>> s) {
    return;
}
#else
#endif

ll find_maximum(int k, vector<vector<int>> x) {
    int n = x.size();
    int m = x[0].size();
    vector<vector<int>> res(n, vector<int>(m, -1));
    assert(m == 1);
    vector<int> all;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            res[i][j] = 0;
            all.push_back(x[i][j]);
        }
    }
    allocate_tickets(res);
    sort(all.begin(), all.end());
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (i < n / 2) {
            ans -= all[i];
        } else {
            ans += all[i];
        }
    }
    return ans;
}
#ifdef LOCAL
int main() {
//    freopen("file.in", "r", stdin);
//    string line; cin >> line;
    int n, m, k; cin >> n >> m >> k;
    vector<vector<int>> s(n, vector<int>(m, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> s[i][j];
        }
    }
    find_maximum(k, s);
    return 0;
}
#else
#endif
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...