fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. bool comp1( double a, double b ) {
  6. cout <<a<<"--"<<b<<";"<< endl;
  7. return a < b;
  8. }
  9.  
  10. int main() {
  11. int n;
  12. cin>>n;
  13. double *x= new double[n];
  14. for ( int i=0; i<n; i++ ) {
  15. cin>>x[i];
  16. }
  17. cout << "graph G{" << endl;
  18. sort(x, x + n, comp1);
  19. cout << "}" <<endl;
  20.  
  21.  
  22. cout<<endl;
  23. }
  24.  
Success #stdin #stdout 0s 5348KB
stdin
10
3 501 12 0 5 8 12 67 52 46
stdout
graph G{
501--3;
501--3;
12--3;
12--501;
12--3;
0--3;
5--0;
5--501;
5--12;
5--3;
8--0;
8--501;
8--12;
8--5;
12--0;
12--501;
12--12;
67--0;
67--501;
67--12;
52--0;
52--501;
52--67;
52--12;
46--0;
46--501;
46--67;
46--52;
46--12;
}