Language: C++



#include <iostream>
 
using namespace std;
 
 
#define MAX 500000
#define SENTINEL 2000000000
 
int L[MAX/2+2], R[MAX/2+2];
int cnt;
 
void merge(int A[],int n,int left, int mid, int right) {
  int n1 = mid -left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i=0, j=0;
  for(int k=left; k<right; k++) {
    cnt++;
    if(L[i]<=R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
 
void mergeSort(int A[],int n,int left,int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}
 
int main(void) {
  int A[MAX], n, i;
  cnt = 0;
 
    cin >> n;
  for(i=0;i<n;i++) cin >> A[i];
 
  mergeSort(A, n, 0, n);
  for(i=0;i<n;i++) {
    if(i)cout << " ";
    cout << A[i];
  }
  cout << endl;
 
  cout << cnt << endl;
 
  return 0;
}
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 
??????????????? 
Judge: 10/10  C++  CPU: 00.20 sec  Memory: 6976 KB  Length: 939 B  2017-11-10 14:02  2017-11-10 14:02  
???????????±????????????????????? 
Case # Verdict CPU Time Memory In Out Case Name 
 Case #1: : Accepted  00.00 sec 3004 KB    
 Case #2: : Accepted  00.00 sec 3008 KB    
 Case #3: : Accepted  00.00 sec 3088 KB    
 Case #4: : Accepted  00.00 sec 3096 KB    
 Case #5: : Accepted  00.00 sec 3092 KB    
 Case #6: : Accepted  00.00 sec 3004 KB    
 Case #7: : Accepted  00.00 sec 3072 KB    
 Case #8: : Accepted  00.03 sec 3888 KB    
 Case #9: : Accepted  00.06 sec 4548 KB    
 Case #10: : Accepted  00.20 sec 6976 KB    



 < prev | 1 /  10 | next >      : Accepted        00.00 sec        3004 KB 

 

Judge Input #1 (  | )  Judge Output #1 (  | ) 


  

 

Comments 
 

 ??\????????§?????? 

 
Categories 
 



 
Free Tags 
 



 

Compiler output:
a.cc:68:12: error: extended character ± is not valid in an identifier
   68 | ???????????±?????????????????????
      |            ^
a.cc:69:6: error: stray '#' in program
   69 | Case # Verdict CPU Time Memory In Out Case Name
      |      ^
a.cc:70:7: error: stray '#' in program
   70 |  Case #1: : Accepted  00.00 sec 3004 KB
      |       ^
a.cc:71:7: error: stray '#' in program
   71 |  Case #2: : Accepted  00.00 sec 3008 KB
      |       ^
a.cc:72:7: error: stray '#' in program
   72 |  Case #3: : Accepted  00.00 sec 3088 KB
      |       ^
a.cc:73:7: error: stray '#' in program
   73 |  Case #4: : Accepted  00.00 sec 3096 KB
      |       ^
a.cc:74:7: error: stray '#' in program
   74 |  Case #5: : Accepted  00.00 sec 3092 KB
      |       ^
a.cc:75:7: error: stray '#' in program
   75 |  Case #6: : Accepted  00.00 sec 3004 KB
      |       ^
a.cc:76:7: error: stray '#' in program
   76 |  Case #7: : Accepted  00.00 sec 3072 KB
      |       ^
a.cc:77:7: error: stray '#' in program
   77 |  Case #8: : Accepted  00.03 sec 3888 KB
      |       ^
a.cc:78:7: error: stray '#' in program
   78 |  Case #9: : Accepted  00.06 sec 4548 KB
      |       ^
a.cc:79:7: error: stray '#' in program
   79 |  Case #10: : Accepted  00.20 sec 6976 KB
      |       ^
a.cc:87:13: error: stray '#' in program
   87 | Judge Input #1 (  | )  Judge Output #1 (  | )
      |             ^
a.cc:87:37: error: stray '#' in program
   87 | Judge Input #1 (  | )  Judge Output #1 (  | )
      |                                     ^
a.cc:97:4: error: stray '\' in program
   97 |  ??\????????§??????
      |    ^
a.cc:97:13: error: extended character § is not valid in an identifier
   97 |  ??\????????§??????
      |             ^
a.cc:61:1: error: 'Compile' does not name a type
   61 | Compile Error Logs:
      | ^~~~~~~