제출 #137929

#제출 시각아이디문제언어결과실행 시간메모리
137929zoooma13Minerals (JOI19_minerals)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
#include "minerals.h"
#include "grader.cpp"
using namespace std;

void go(vector<int> h1 ,vector<int> h2){
    if(h1.size() == 1 && h2.size() == 1){
        Answer(h1.front() ,h2.front());
        return;
    }

    vector <int> nh1 = vector<int>{h1.begin() ,h1.begin()+h1.size()/2};
    vector <int> nh2 = vector<int>{h1.begin()+h1.size()/2 ,h1.end()};
    for(int i=0; i<nh1.size(); i++)
        Query(nh1[i]);

    vector <int> mh1 ,mh2;
    for(int i=0; i<h2.size(); i++){
        if(Query(h2[i]) == nh1.size())
            mh1.push_back(h2[i]);
        else
            mh2.push_back(h2[i]);
        Query(h2[i]);
    }

    for(int i=0; i<nh1.size(); i++)
        Query(nh1[i]);

    if(nh1.size()) go(nh1 ,mh1);
    if(nh2.size()) go(nh2 ,mh2);
}

void Solve(int N) {
    vector <int> h1 ,h2;
    for(int lst=0,i=1; i<=2*N; i++){
        if(Query(i) == lst)
            h2.push_back(i);
        else
            h1.push_back(i) ,lst++;
    }
    for(int i=1; i<=2*N; i++)
        Query(i);

    go(h1 ,h2);
}

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

minerals.cpp: In function 'void go(std::vector<int>, std::vector<int>)':
minerals.cpp:14:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<nh1.size(); i++)
                  ~^~~~~~~~~~~
minerals.cpp:18:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<h2.size(); i++){
                  ~^~~~~~~~~~
minerals.cpp:19:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(Query(h2[i]) == nh1.size())
            ~~~~~~~~~~~~~^~~~~~~~~~~~~
minerals.cpp:26:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<nh1.size(); i++)
                  ~^~~~~~~~~~~
/tmp/ccxw42D3.o: In function `Query(int)':
grader.cpp:(.text+0x20): multiple definition of `Query(int)'
/tmp/ccNAuQHb.o:minerals.cpp:(.text+0x20): first defined here
/tmp/ccxw42D3.o: In function `Answer(int, int)':
grader.cpp:(.text+0xf0): multiple definition of `Answer(int, int)'
/tmp/ccNAuQHb.o:minerals.cpp:(.text+0xf0): first defined here
/tmp/ccxw42D3.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccNAuQHb.o:minerals.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status