Submission #689813

#TimeUsernameProblemLanguageResultExecution timeMemory
689813TomitaMateiTable Tennis (info1cup20_tabletennis)C++14
49 / 100
302 ms512 KiB
#include <iostream> #include <algorithm> using namespace std; int n,k,i,j,i1,j2,t,dr,st,s,nr,v[16000],r[16000],ok; int main() { cin>>n>>k; for (i=1; i<=n+k; i++) cin>>v[i]; sort (v+1,v+n+k+1); for (st=1; st<=k+1; st++) for (dr=n+k; dr>=n+st-1; dr--) { i=st; j=dr; s=v[i]+v[j]; nr=1; r[1]=v[i]; r[n-nr+1]=v[j]; i++; j--; ok=0; if (nr*2==n) { for (i=1; i<=n; i++) cout<<r[i]<<" "; return 0; } while (i<j) { for (j2=j; j2>i; j2--) if (s==v[i]+v[j2]) { nr++; r[n-nr+1]=v[j2]; r[nr]=v[i]; ok=1; break; } if (nr*2==n) { for (i=1; i<=n; i++) cout<<r[i]<<" "; return 0; } if (ok==0) i++; else { ok=0; i++; j=j2-1; } } } return 0; }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:9:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    9 |     for (i=1; i<=n+k; i++)
      |     ^~~
tabletennis.cpp:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   11 |         sort (v+1,v+n+k+1);
      |         ^~~~
#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...