Submission #717364

# Submission time Handle Problem Language Result Execution time Memory
717364 2023-04-01T21:40:20 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
0 / 100
3000 ms 10828 KB
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define int long long
const int sz = 4e5 + 5;
const int mod = 1e9 + 7;
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int>v(n + m);
    map<int, int>mp;
    for (int i = 0; i <= n; i++) {
        cin >> v[i];
        mp[v[i]] = i + 1;
    }
    sort(all(v));
    int sum1 = 0, sum2 = 0;
    int l = 0, r = n - 1;
    while (l < r) {
        if (l % 2 == 0) {
            sum1 += v[l] + v[r];
        }
        else sum2 += v[l] + v[r];
        l++;
        r--;
    }
    if (sum1 == sum2) {
        for (int i = 0; i < n; i++) {
            cout << mp[v[i]] << ' ';
        }
        return 0;
    }
    for (int i = 0; i < n; i++) {
        swap(v[i], v[n]);
        sort(v.begin(), v.begin() + n);
        sum1 = 0, sum2 = 0;
        l = 0, r = n - 1;
        while (l < r) {
            if (l % 2 == 0) {
                sum1 += v[l] + v[r];
            }
            else sum2 += v[l] + v[r];
            l++;
            r--;
        }
        if (sum1 == sum2) {
            for (int i = 0; i < n; i++) {
                cout << mp[v[i]] << ' ';
            }
            return 0;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2797 ms 1724 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3030 ms 10828 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output not subsequence of input
2 Halted 0 ms 0 KB -