Submission #696961

#TimeUsernameProblemLanguageResultExecution timeMemory
696961noobnessOVERLOADEDBest Place (NOI17_bestplace)C++14
0 / 100
87 ms2960 KiB
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  int a[n];
  int b[n];

  for(int i = 0; i <= n-1; i++){
    cin >> a[i];
  }

  for(int j = 0; j <= n-1; j++){
    cin >> b[j];
  }

  int c = n/2;
  int k = 2*c;
  int d = n-k;

  sort(a, a+n);
  sort(b, b+n);

  if(d = 1){
    int c = n/2;
    int sum1 = a[c+1];
    int sum2 = b[c+1];

    cout << sum1 << " " << sum2;
  }

  else{
    int c = n/2;
    int sum1 = (a[c]+a[c+1])/2;
    int sum2 = (b[c]+b[c+1])/2;

    cout << sum1 << " " << sum2;
  }


}

Compilation message (stderr)

bestplace.cpp: In function 'int main()':
bestplace.cpp:25:8: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   25 |   if(d = 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...