제출 #320240

#제출 시각아이디문제언어결과실행 시간메모리
320240blue슈퍼트리 잇기 (IOI20_supertrees)C++17
컴파일 에러
0 ms0 KiB
#include "supertrees.h"
#include <vector>
#include <set>
using namespace std;

int construct(vector< vector<int> > p)
{
    int n = p.size();
    vector< vector<int> > b(n);
    for(int i = 0; i < n; i++) b[i] = vector<int>(n, 0);

    vector<int> group(n, -1);
    set<int> grouplist;
    for(int i = 0; i < n; i++)
    {
        group[i] = i;
        grouplist.clear();
        for(int j = 0; j < i; j++) if(p[i][j]) grouplist.push_back(group[j]);
        for(int j = 0; j < i; j++) if(grouplist.find(group[j]) != grouplist.end()) group[j] = i;
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(group[i] == group[j] && p[i][j] == 0) return 0;
            if(group[i] != group[j] && p[i][j] == 1) return 0;
        }
    }

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < i; j++)
        {
            if(p[i][j])
            {
                b[i][j] = 1;
                break;
            }
        }
    }
    build(b);

    return 1;
}

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:18:58: error: 'class std::set<int>' has no member named 'push_back'
   18 |         for(int j = 0; j < i; j++) if(p[i][j]) grouplist.push_back(group[j]);
      |                                                          ^~~~~~~~~