fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. struct info {
  8. int st;
  9. int en;
  10. int val;
  11. };
  12.  
  13. bool cmp(const info &f1, const info &f2)
  14. {
  15. return f1.en < f2.en;
  16. }
  17.  
  18. int main()
  19. {
  20. ios_base::sync_with_stdio(false);
  21. cin.tie(0);
  22. int n, x, y, z, ans = -1e9;
  23. cin >> n;
  24. vector<info> arr(n);
  25. vector<int> res(n);
  26. for (int i = 0; i < n; ++i) {
  27. cin >> x >> y;
  28. info myinfo = {x, y, y - x};
  29. arr.push_back(myinfo);
  30. }
  31. for (int i = 0; i < n; ++i) cout << arr[i].st << " " << arr[i].en << " " << arr[i].val << endl;
  32. return 0;
  33. }
Success #stdin #stdout 0s 15240KB
stdin
12
1 2
3 5
0 4
6 8
7 13
4 6
9 10
9 12
11 14
15 19
14 16
18 20
stdout
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0