제출 #289845

#제출 시각아이디문제언어결과실행 시간메모리
289845IgorISplit the Attractions (IOI19_split)C++17
11 / 100
123 ms12664 KiB
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <cstdlib>
#include <iostream>
#include <map>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int (i) = 0; (i) < (n); (i)++)

const int N = 540400;

vector<int> find_split(int n, int a, int b, int c, vector<int> v, vector<int> u)
{
    vector<int> q = {0};
    vector<vector<int> > graph(n);
    for (int i = 0; i < v.size(); i++) graph[v[i]].push_back(u[i]), graph[u[i]].push_back(v[i]);
    vector<int> vis(n);
    vis[0] = 2;
    for (int i = 0; i < q.size() && q.size() < b; i++)
    {
        for (int j = 0; j < graph[q[i]].size() && q.size() < b; j++)
        {
            int u = graph[q[i]][j];
            if (vis[u] == 0)
            {
                vis[u] = 2;
                q.push_back(u);
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (vis[i] == 0)
        {
            vis[i] = 1;
            break;
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (vis[i] == 0)
        {
            vis[i] = 3;
        }
    }
    return vis;
}

컴파일 시 표준 에러 (stderr) 메시지

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < v.size(); i++) graph[v[i]].push_back(u[i]), graph[u[i]].push_back(v[i]);
      |                     ~~^~~~~~~~~~
split.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < q.size() && q.size() < b; i++)
      |                     ~~^~~~~~~~~~
split.cpp:23:46: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     for (int i = 0; i < q.size() && q.size() < b; i++)
      |                                     ~~~~~~~~~^~~
split.cpp:25:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for (int j = 0; j < graph[q[i]].size() && q.size() < b; j++)
      |                         ~~^~~~~~~~~~~~~~~~~~~~
split.cpp:25:60: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |         for (int j = 0; j < graph[q[i]].size() && q.size() < b; j++)
      |                                                   ~~~~~~~~~^~~
#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...