Submission #1080475

#TimeUsernameProblemLanguageResultExecution timeMemory
1080475speedcodeSplit the Attractions (IOI19_split)C++17
0 / 100
50 ms12880 KiB

#include <bits/stdc++.h>
using namespace std;

std::vector<int> find_split(int n, int a, int b, int c, std::vector<int> p, std::vector<int> q){
    vector<vector<int>> graphe(n);
    for(int i = 0; i < p.size(); i++){
        graphe[p[i]].push_back(q[i]);
        graphe[q[i]].push_back(p[i]);
    }

    vector<int> result(n);
    fill(result.begin(), result.end(), 3);

    queue<int> bfs;
    bfs.push(0);
    while(!bfs.empty() && b--) {
        int u = bfs.front();
        bfs.pop();
        result[u] = 2;
        for(int v : graphe[u]) {
            if(result[v] == 3) {
                bfs.push(v);
            }
        }
    }

    for(int i = 0; i < n; i++) {
        if(result[i] == 3) {
            result[i] = 1;
            break;
        }
    }

    return result;
}

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i = 0; i < p.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...