제출 #667661

#제출 시각아이디문제언어결과실행 시간메모리
667661LFFBTable Tennis (info1cup20_tabletennis)C++14
20 / 100
80 ms2480 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 != 1) return 1; m = n + k; for (int i = 0; i < m; i++) { scanf("%d", &input[i]); } std::sort(input, input+m); int bad = -1; // find bad one for (int x = 0; x < m; x++) { debug("at x = %d\n", x); int i = 0; int j = m-1; if (i == x) i++; if (j == x) 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 (j == x) j--; } if (valid) { bad = input[x]; debug("bad = input[%d] = %d\n", x, input[x]); break; } } for (int i = 0; i < m; i++) { if (input[i] == bad) continue; printf("%d ", input[i]); } printf("\n"); }

컴파일 시 표준 에러 (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...