Guest User

Untitled

a guest
May 27th, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <set>
  4. #include <vector>
  5. #include <cstdio>
  6. #include <string>
  7. #include <algorithm>
  8. #include <functional>
  9.  
  10. using namespace std;
  11.  
  12. struct molecule{
  13.     string formula;
  14.     int mass;
  15.     molecule(string a, int b):formula(a), mass(b){};
  16. };
  17.  
  18. struct data {
  19.     string name, formula;
  20.     int mass;
  21.     data(string a, string b, int c)
  22.     :name(a), formula(b), mass(c){};
  23. };
  24.  
  25. class Sort{
  26.     private:
  27.         vector<double> vec;
  28.         vector<data> vec2;
  29.         map<string, molecule> table2;
  30.         int n;
  31.     public :
  32.         Sort(int);
  33.         void quick_sort(int begin, int end);
  34. };
  35.  
  36. int main () {
  37.     int cases, n;
  38.     cin >> cases;
  39.     for (int i=0; i<cases; i++) {
  40.         cin >> n;
  41.         Sort A(n);
  42.     }
  43.     return 0;
  44. }
  45.  
  46. Sort::Sort(int b):n(b) {
  47.     string name, formula, mass;
  48.     vec.resize(n);
  49.     vec2.resize(n);
  50.     for (int i=0; i<n; i++) {
  51.         cin >> name >> formula >> mass;
  52.     }
  53. }
  54.  
  55. /*
  56. void Sort::quick_sort(const int begin, const int end) {
  57.     if (begin < end) {
  58.         int i=begin, j=end+1;
  59.         auto &pivot=vec[begin];
  60.         do {
  61.             do j--; while (vec[j] > pivot);
  62.             do {
  63.                 i++;   
  64.             } while (i<j && vec[i] <=vec[j]);
  65.             if (i<j) swap(vec[i], vec[j]);
  66.         } while (i < j);
  67.         swap(pivot, vec[j]);
  68.         quick_sort(begin, j-1);
  69.         quick_sort(j+1, end);
  70.     }
  71. }
  72. */
Advertisement
Add Comment
Please, Sign In to add comment