fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. bool cmp(int a,int b){
  6. cout <<a<<" "<<b<<endl;
  7. return rand()&1;
  8. }
  9.  
  10. int main() {
  11. int K[11] = {1,2,3,4,5,6,7,8,9,10};
  12. sort(K,K+11,cmp);
  13. for (int i=0;i<11;i++)
  14. cout << K[i]<<" ";
  15. // your code goes here
  16. return 0;
  17. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
2 1
3 2
3 1
3 2
3 -1216169036
3 134514976
3 134514976
4 -1216169036
4 1
4 2
4 -1216169036
5 -1216169036
6 5
6 1
6 2
6 4
7 5
7 1
8 5
8 7
9 5
10 9
10 8
10 7
10 1
0 9
0 8
9 5 -1216169036 4 6 2 1 10 7 8 0