제출 #365986

#제출 시각아이디문제언어결과실행 시간메모리
365986ahmedfouadnewTable Tennis (info1cup20_tabletennis)C++17
87 / 100
3084 ms65404 KiB
#include<bits/stdc++.h> using namespace std; #define s second #define f first #define pb push_back //#define int long long int n,a[200001],k; unordered_map<int,int>mp; void fun(int bal) { vector<int>v; int cnt=0; for(int i=0;i<n+k;i++) { if(mp[bal-a[i]]) { v.pb(a[i]); } else cnt++; if(cnt>k) return; } if(v.size()!=n) return; for(int i=0;i<v.size();i++) { if(i) printf(" "); printf("%d",v[i]); } exit(0); } signed main() { scanf("%d%d",&n,&k); for(int i=0;i<n+k;i++) { scanf("%d",a+i); mp[a[i]]=1; } for(int i=0;i<=k+1;i++) { for(int j=n+k-1;j>=n-1;j--) { fun(a[i]+a[j]); } } return 0; }

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

tabletennis.cpp: In function 'void fun(int)':
tabletennis.cpp:22:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     if(v.size()!=n) return;
      |        ~~~~~~~~^~~
tabletennis.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
tabletennis.cpp: In function 'int main()':
tabletennis.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |     scanf("%d%d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~
tabletennis.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |         scanf("%d",a+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...