Submission #717302

# Submission time Handle Problem Language Result Execution time Memory
717302 2023-04-01T19:58:45 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
0 / 100
56 ms 3556 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

const int M = 2e5+5, MOD = 998244353;
int v[M], ind[M];

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    
    int n, k;
    cin >> n >> k;

    n += k;
    for (int i = 1; i <= n; i++) cin >> v[i];
    for (int i = 1; i <= n; i++) ind[i] = i;
    sort(ind+1, ind+n+1, [](int a, int b) {return v[a] < v[b];});
    sort(v+1, v+n+1);

    map<int, int> fr;
    for (int i = 1; i < n; i++) fr[v[i+1]-v[i]]++;

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i > 1) {fr[v[i]-v[i-1]]--; if (!fr[v[i]-v[i-1]]) fr.erase(v[i]-v[i-1]);}
        if (i < n) {fr[v[i+1]-v[i]]--; if (!fr[v[i+1]-v[i]]) fr.erase(v[i+1]-v[i]);}
        if (i > 1 && i < n) fr[v[i+1]-v[i-1]]++;
        if (fr.size() == 1) ans = ind[i];

        if (i > 1) fr[v[i]-v[i-1]]++;
        if (i < n) fr[v[i+1]-v[i]]++;
        if (i > 1 && i < n) {fr[v[i+1]-v[i-1]]--; if (!fr[v[i+1]-v[i-1]]) fr.erase(v[i+1]-v[i-1]);};
    }

    for (int i = 1; i <= n; i++) if (i != ans) cout << i << ' '; cout << endl;

    return 0;
}
/*
5 1
1 5 2 3 4 3
*/

Compilation message

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:37:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 |     for (int i = 1; i <= n; i++) if (i != ans) cout << i << ' '; cout << endl;
      |     ^~~
tabletennis.cpp:37:66: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   37 |     for (int i = 1; i <= n; i++) if (i != ans) cout << i << ' '; cout << endl;
      |                                                                  ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 724 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 3556 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output not subsequence of input
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 -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output not subsequence of input
2 Halted 0 ms 0 KB -