Submission #1007215

#TimeUsernameProblemLanguageResultExecution timeMemory
1007215FaggiData Transfer (IOI19_transfer)C++17
Compilation error
0 ms0 KiB
#include "transfer.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 (stderr)

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:2:378: error: expected '}' at end of input
    2 | 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;}
      |                                                                                                                                                                                                                                                                                                                                                             ~                            ^
transfer.cpp:2:266: warning: unused variable 'dif' [-Wunused-variable]
    2 | 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;}
      |                                                                                                                                                                                                                                                                          ^~~
transfer.cpp:2:378: error: expected '}' at end of input
    2 | 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;}
      |                                                                                                                                                                                                                                                                 ~                                                                                                                        ^
transfer.cpp:2:378: warning: no return statement in function returning non-void [-Wreturn-type]