Submission #346830

#TimeUsernameProblemLanguageResultExecution timeMemory
346830arnold518Table Tennis (info1cup20_tabletennis)C++14
72 / 100
3088 ms78304 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 15e4; const int MAXK = 20; int N, K, A[MAXN+10]; vector<pii> M[3000000+10]; int main() { scanf("%d%d", &N, &K); for(int i=1; i<=N+K; i++) scanf("%d", &A[i]); for(int i=1; i<=N+K; i++) { int t=N+K-i+1; for(int j=max(i+1, t-K); j<=min(N+K, t+K); j++) { M[(A[i]+A[j])%3000001].push_back({A[i], A[j]}); if(M[(A[i]+A[j])%3000001].size()>=N/2) { vector<pii> &it=M[(A[i]+A[j])%3000001]; vector<int> V; for(int i=0; i<N/2; i++) { V.push_back(it[i].first); V.push_back(it[i].second); } sort(V.begin(), V.end()); for(auto it : V) printf("%d ", it); return 0; } } } }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:25:36: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |    if(M[(A[i]+A[j])%3000001].size()>=N/2)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
tabletennis.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d%d", &N, &K);
      |  ~~~~~^~~~~~~~~~~~~~~~
tabletennis.cpp:17:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |  for(int i=1; i<=N+K; i++) 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...