Submission #1102025

# Submission time Handle Problem Language Result Execution time Memory
1102025 2024-10-17T10:23:18 Z razivo Viruses (BOI20_viruses) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int g,n,m; cin>>g>>n>>m;
    vector<vector<vector<int>>> mut(g+1);
    for (int i = 0; i < n; ++i) {
        int x,y; cin>>x>>y;
        int t = mut[x].size();
        mut[x].push_back({});
        for (int j = 0; j < y; ++j) {
            int u; cin>>u;
            mut[x][t].push_back(u);
        }
    }
    vector<vector<int>> anti(m);
    for (int i = 0; i < m; ++i) {
        int l; cin>>l;
        for (int j = 0; j < l; ++j) {
            int u; cin>>u;
            anti[i].push_back(u);
        }
    }
    if(m==0) {
        vector<int> len(g+1,INT_MAX);
        len[0]=1;
        len[1]=1;
        for (int i = 2; i < g+1; ++i) {
            for (int j = 0; j < mut[i].size(); ++j) {
                int res = 0;
                for (int k = 0; k < mut[i][j].size(); ++k) {
                    res+=len[mut[i][j][k]];
                }
                len[i]=min(len[i],res);
            }
        }
        for (int i = 2; i < g+1; ++i) {
            cout<<"NO " << len[i];
        }
    }
}

Compilation message

Viruses.cpp: In function 'int main()':
Viruses.cpp:25:29: error: 'INT_MAX' was not declared in this scope
   25 |         vector<int> len(g+1,INT_MAX);
      |                             ^~~~~~~
Viruses.cpp:3:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Viruses.cpp:29:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for (int j = 0; j < mut[i].size(); ++j) {
      |                             ~~^~~~~~~~~~~~~~~
Viruses.cpp:31:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |                 for (int k = 0; k < mut[i][j].size(); ++k) {
      |                                 ~~^~~~~~~~~~~~~~~~~~