답안 #1007214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007214 2024-06-24T13:18:59 Z Faggi Data Transfer (IOI19_transfer) C++17
컴파일 오류
0 ms 0 KB
#include "transfer.h"#include <bits/stdc++.h>using namespace std;std::vector<int> get_attachment(std::vector<int> source) {    vector<int>ret;    for(auto k:source)        ret.push_back(k);    for(auto k:source)        ret.push_back(k);    return ret;}std::vector<int> retrieve(std::vector<int> data) {    int dif=-1;    vector<int>a,b,c,uc(2,0);    for(int i=0; i<int(data.size())/3; i++)    {        a.push_back(data[i]);        //cout << data[i];    }    //cout << endl;    for(int i=int(data.size())/3; i<int(data.size())-int(data.size())/3; i++)    {        b.push_back(data[i]);        if(b[int(b.size())-1]!=a[int(b.size())-1])        {            dif=int(b.size())-1;        }        //cout << data[i];    }    //cout << endl;    for(int i=int(data.size())-int(data.size())/3; i<int(data.size()); i++)    {        c.push_back(data[i]);        if(c[int(c.size())-1]!=a[int(c.size())-1])        {            dif=int(c.size())-1;        }        else if(c[int(c.size())-1]!=b[int(c.size())-1])        {            dif=int(c.size())-1;                    }        //cout << data[i];    }    //cout << endl;    if(dif==-1)    return a;    //cout << dif;    uc[a[dif]]++;    uc[b[dif]]++;    uc[c[dif]]++;    if(uc[0]>uc[1])        a[dif]=0;    else        a[dif]=1;    //for(auto k:a)    //cout << k;            return a;}

Compilation message

transfer.cpp:1:22: warning: extra tokens at end of #include directive
    1 | #include "transfer.h"#include <bits/stdc++.h>using namespace std;std::vector<int> get_attachment(std::vector<int> source) {    vector<int>ret;    for(auto k:source)        ret.push_back(k);    for(auto k:source)        ret.push_back(k);    return ret;}std::vector<int> retrieve(std::vector<int> data) {    int dif=-1;    vector<int>a,b,c,uc(2,0);    for(int i=0; i<int(data.size())/3; i++)    {        a.push_back(data[i]);        //cout << data[i];    }    //cout << endl;    for(int i=int(data.size())/3; i<int(data.size())-int(data.size())/3; i++)    {        b.push_back(data[i]);        if(b[int(b.size())-1]!=a[int(b.size())-1])        {            dif=int(b.size())-1;        }        //cout << data[i];    }    //cout << endl;    for(int i=int(data.size())-int(data.size())/3; i<int(data.size()); i++)    {        c.push_back(data[i]);        if(c[int(c.size())-1]!=a[int(c.size())-1])        {            dif=int(c.size())-1;        }        else if(c[int(c.size())-1]!=b[int(c.size())-1])        {            dif=int(c.size())-1;                    }        //cout << data[i];    }    //cout << endl;    if(dif==-1)    return a;    //cout << dif;    uc[a[dif]]++;    uc[b[dif]]++;    uc[c[dif]]++;    if(uc[0]>uc[1])        a[dif]=0;    else        a[dif]=1;    //for(auto k:a)    //cout << k;            return a;}
      |                      ^
/usr/bin/ld: /tmp/ccB2ZDUc.o: in function `pass1()':
grader.cpp:(.text+0xb58): undefined reference to `get_attachment(std::vector<int, std::allocator<int> >)'
/usr/bin/ld: /tmp/ccB2ZDUc.o: in function `pass2()':
grader.cpp:(.text+0x19b1): undefined reference to `retrieve(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status