Submission #346804

#TimeUsernameProblemLanguageResultExecution timeMemory
346804arnold518Table Tennis (info1cup20_tabletennis)C++14
72 / 100
3073 ms6188 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize ("avx, avx2, fma") #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 = 400; int N, K, A[MAXN+10]; pii V[MAXN*(MAXK*2+1)+10]; int main() { scanf("%d%d", &N, &K); for(int i=1; i<=N+K; i++) scanf("%d", &A[i]); int t=0; for(int i=1; i<=N+K; i++) { int tt=N+K-i+1; for(int j=max(i+1, tt-K); j<=min(N+K, tt+K); j++) { V[t++]={A[i], A[j]}; } } sort(V, V+t, [&](const pii &p, const pii &q) { return p.first+p.second<q.first+q.second; }); for(int i=0; i<t;) { int j; for(j=i; j<t && V[i].first+V[i].second==V[j].first+V[j].second; j++); if(j-i>=N/2) { vector<int> VV; for(int k=i; k<i+N/2; k++) { VV.push_back(V[k].first); VV.push_back(V[k].second); } sort(VV.begin(), VV.end()); for(auto it : VV) printf("%d ", it); printf("\n"); return 0; } i=j; } }

Compilation message (stderr)

tabletennis.cpp:4:39: warning: bad option '-favx' to pragma 'optimize' [-Wpragmas]
    4 | #pragma GCC optimize ("avx, avx2, fma")
      |                                       ^
tabletennis.cpp:4:39: warning: bad option '-f avx2' to pragma 'optimize' [-Wpragmas]
tabletennis.cpp:4:39: warning: bad option '-f fma' to pragma 'optimize' [-Wpragmas]
tabletennis.cpp:19:10: warning: bad option '-favx' to attribute 'optimize' [-Wattributes]
   19 | int main()
      |          ^
tabletennis.cpp:19:10: warning: bad option '-f avx2' to attribute 'optimize' [-Wattributes]
tabletennis.cpp:19:10: warning: bad option '-f fma' to attribute 'optimize' [-Wattributes]
tabletennis.cpp: In function 'int main()':
tabletennis.cpp:34:45: warning: bad option '-favx' to attribute 'optimize' [-Wattributes]
   34 |  sort(V, V+t, [&](const pii &p, const pii &q)
      |                                             ^
tabletennis.cpp:34:45: warning: bad option '-f avx2' to attribute 'optimize' [-Wattributes]
tabletennis.cpp:34:45: warning: bad option '-f fma' to attribute 'optimize' [-Wattributes]
tabletennis.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |  scanf("%d%d", &N, &K);
      |  ~~~~~^~~~~~~~~~~~~~~~
tabletennis.cpp:22:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |  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...