제출 #1080468

#제출 시각아이디문제언어결과실행 시간메모리
1080468speedcodeSplit the Attractions (IOI19_split)C++17
0 / 100
1 ms348 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);
    int begin  = 0;
    for(int i = 0; i < n; i++) {
        if(graphe[i].size() == 1) begin = i;
    }
    while(a--) {
        result[begin] = 1;
        for(auto k : graphe[begin]) {
            if(result[k] == 3) {
                begin = k;
            }
        }
    }
    while(b--) {
        result[begin] = 2;
        for(auto k : graphe[begin]) {
            if(result[k] == 3) {
                begin = k;
            }
        }
    }
}

컴파일 시 표준 에러 (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++){
      |                    ~~^~~~~~~~~~
split.cpp:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
#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...