제출 #667609

#제출 시각아이디문제언어결과실행 시간메모리
667609ericTable Tennis (info1cup20_tabletennis)C++14
20 / 100
40 ms2892 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, k, wrong; scanf("%d %d", &n, &k); long long int v[n + k], som = 0; for(int i = 0; i < n + k; i++){ scanf("%lld", &v[i]); som += v[i]; } for(int i = 0; i < n + k; i++){ long long int m = (som - v[i])*2; if(m%n != 0){ //printf("%d %d\n", som, v[i]); continue; } m /= n; long long int comp; if(i == 0)comp = v[1] + v[n + k - 1]; else if(i == n + k - 1)comp = v[0] + v[n + k - 2]; else comp = v[0] + v[n + k - 1]; //printf("%f %f\n", m, comp); if(m == comp){ wrong = v[i]; break; } } //sort(v, v + (n + k)); for(int i = 0; i < n + k; i++){ if(v[i] == wrong)continue; printf("%d ", v[i]); } }

컴파일 시 표준 에러 (stderr) 메시지

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:33:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   33 |         printf("%d ", v[i]);
      |                 ~^    ~~~~
      |                  |       |
      |                  int     long long int
      |                 %lld
tabletennis.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
tabletennis.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%lld", &v[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
tabletennis.cpp:32:20: warning: 'wrong' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |         if(v[i] == wrong)continue;
      |                    ^~~~~
#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...