Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
1.1 kB
0
Indexable
Never
#include <iostream>
#include <string>
#include <vector>

void attack(std::vector<int>& walls, const std::vector<int>& zalp,bool &lose) {
    for (int i = 0; i < zalp.size(); i++) {
        walls[zalp[i] - 1] -= 1;
        if (walls[zalp[i] - 1] <= 0) {
            lose = true;
            break;
        }
    }
        

}

int main()
{
    bool lose = false;
    std::vector<int> walls{};
    int n, health;
    int zalps, sizeZalp,damage;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> health;
        walls.push_back(health);
    }
    std::vector<int> zalp{0};
    std::cin >> zalps;
    for (int i = 0; i < zalps; i++) {
        std::cin >> sizeZalp;
        zalp.resize(sizeZalp);
        for (int j = 0; j < sizeZalp;j++) {
            std::cin >> zalp[j];
        }
        attack(walls, zalp, lose);
        if (lose) {
            std::cout << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
            break;
        }
    }if (lose == false) {
        std::cout << "Ok";
    }
}

Leave a Comment