Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- //
- //class Unit {
- //public:
- // Unit(int health) : mHealth(health) {
- // cout << "Unit has benn created!" << '\n';
- // }
- // ~Unit() {
- // cout << "Unit has been destroyed!" << '\n';
- // }
- //protected:
- // int mHealth;
- //};
- //
- //class Archer : virtual public Unit {
- //public:
- // Archer(int health) : Unit(health) { cout << "Archer has been created!" << '\n'; }
- // ~Archer() { cout << "Archer has been destroyed!" << '\n'; }
- //protected:
- //};
- //
- //class Wizard : virtual public Unit {
- //public:
- // Wizard(int health) : Unit(health) { cout << "Wizard has been created!" << '\n'; }
- // ~Wizard() { cout << "Wizard has been destroyed!" << '\n'; }
- //protected:
- //};
- //
- //class WizardArcher : public Archer, public Wizard {
- //public:
- // WizardArcher(int health) : Unit(health), Archer(health), Wizard(health) { cout << "WizardArcher has been created!" << '\n'; }
- // ~WizardArcher() { cout << "WizardArcher has been destroyed!" << '\n'; }
- //protected:
- //};
- //
- //class Animal {
- //public:
- // virtual void makeSound() = 0;
- //};
- //
- //class Dog : public Animal {
- //public:
- // void makeSound() override {
- // cout << "Wow" << '\n';
- // }
- //};
- //
- //class Fish : public Animal {
- //public:
- // void makeSound() override {
- // cout << "..." << '\n';
- // }
- //};
- //
- //class Unicorn : public Animal {
- //public:
- // void makeSound() override {
- // cout << "Ego-go-go/ihohohohoho" << '\n';
- // }
- //};
- //
- //int main() {
- //// WizardArcher wizardArcher(50);
- // Dog dog;
- //}
- int main() {
- // int testsCount;
- // cin >> testsCount;
- //
- // for (int i = 0; i < testsCount; ++i) {
- // int n;
- // cin >> n;
- //
- // vector<int> firstArray (n);
- // vector<int> secondArray (n);
- //
- // for (int &value : firstArray) {
- // cin >> value;
- // }
- // for (int &value : secondArray) {
- // cin >> value;
- // }
- //
- // sort(firstArray.begin(), firstArray.end());
- // sort(secondArray.begin(), secondArray.end());
- //
- // for (int &value : firstArray) {
- // cout << value << ' ';
- // }
- // cout << '\n';
- // for (int &value : secondArray) {
- // cout << value << ' ';
- // }
- // cout << '\n';
- // }
- // int testsCount;
- // cin >> testsCount;
- //
- // for (int i = 0; i < testsCount; ++i) {
- // int n;
- // cin >> n;
- //
- // vector<int> values(n);
- // for (int &value : values) {
- // cin >> value;
- // }
- //
- // sort(values.begin(), values.end());
- // reverse(values.begin(), values.end());
- // for (int value : values) {
- // cout << value << ' ';
- // }
- // cout << '\n';
- //
- // }
- // int n;
- // cin >> n;
- // vector<int> bArray(n);
- // for (int &value : bArray) {
- // cin >> value;
- // }
- //
- // // b_i = a_i - x_i
- // // a_i = b_i + x_i
- // // have: b_i
- // // find: x_i
- // // have a_1 ... a_{i - 1}
- // // have : x_{i+1} = max(0, a_1, ....., a_i)
- //
- // // we have: [b_1, ..., b_n]
- // // we have: [a_1, ..., a_{i-1}]
- // // find: a_{i}
- // // a_i = b_i + x_i
- // // find: x_i
- // // x_i = max(0, a_1, ..., a_{i-1})
- // // have: x_i
- // vector<int> aArray(n);
- // int x_i = 0;
- // for (int i = 0; i < n; ++i) {
- // aArray[i] = bArray[i] + x_i;
- // cout << aArray[i] << ' ';
- // x_i = max(x_i, aArray[i]);
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement