Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <set>
- #include <vector>
- #include <cstdio>
- #include <string>
- #include <algorithm>
- #include <functional>
- using namespace std;
- struct molecule{
- string formula;
- int mass;
- molecule(string a, int b):formula(a), mass(b){};
- };
- struct data {
- string name, formula;
- int mass;
- data(string a, string b, int c)
- :name(a), formula(b), mass(c){};
- };
- class Sort{
- private:
- vector<double> vec;
- vector<data> vec2;
- map<string, molecule> table2;
- int n;
- public :
- Sort(int);
- void quick_sort(int begin, int end);
- };
- int main () {
- int cases, n;
- cin >> cases;
- for (int i=0; i<cases; i++) {
- cin >> n;
- Sort A(n);
- }
- return 0;
- }
- Sort::Sort(int b):n(b) {
- string name, formula, mass;
- vec.resize(n);
- vec2.resize(n);
- for (int i=0; i<n; i++) {
- cin >> name >> formula >> mass;
- }
- }
- /*
- void Sort::quick_sort(const int begin, const int end) {
- if (begin < end) {
- int i=begin, j=end+1;
- auto &pivot=vec[begin];
- do {
- do j--; while (vec[j] > pivot);
- do {
- i++;
- } while (i<j && vec[i] <=vec[j]);
- if (i<j) swap(vec[i], vec[j]);
- } while (i < j);
- swap(pivot, vec[j]);
- quick_sort(begin, j-1);
- quick_sort(j+1, end);
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment