Submission #667676

#TimeUsernameProblemLanguageResultExecution timeMemory
667676LFFBTable Tennis (info1cup20_tabletennis)C++14
0 / 100
3059 ms840 KiB
#include <iostream> #include <algorithm> #define debug(args...) //printf(args) const int MAX_M = 16e4; typedef long long llong; int n, m, k; int input[MAX_M]; int main() { scanf("%d %d", &n, &k); if (k != 2) return 1; m = n + k; for (int i = 0; i < m; i++) { scanf("%d", &input[i]); } std::sort(input, input+m); int bad1 = -1; int bad2 = -1; // find bad one for (int x = 0; x < m; x++) { for (int y = x+1; y < m; y++) { debug("at x = %d\n", x); int i = 0; int j = m-1; if (i == x) i++; if (i == y) i++; if (j == x) j--; if (j == y) j--; int sum = input[i] + input[j]; bool valid = true; while (valid) { if (j < i) break; if (input[i] + input[j] != sum) { debug("i=%d, j=%d, %d + %d != %d\n", i, j, input[i], input[j], sum); valid = false; } i++; j--; if (i == x) i++; if (i == y) i++; if (j == x) j--; if (j == y) j--; } if (valid) { bad1 = input[x]; bad2 = input[y]; break; } } } for (int i = 0; i < m; i++) { if (input[i] == bad1) continue; if (input[i] == bad2) continue; printf("%d ", input[i]); } printf("\n"); }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
tabletennis.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d", &input[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...