답안 #541542

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541542 2022-03-23T18:09:12 Z fadi57 도서관 (JOI18_library) C++14
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <vector>
//#include "library.h"
#include "grader.cpp"
#include "bits/stdc++.h"
using namespace std;

void Solve(int n)
{
	if(n==1){
        vector<int>ans;
        ans={1};
       Answer (ans);
       return;
	}
  vector<int>q(n,1);int st=0;
  for(int i=0;i<n;i++){
        q[i]=0;
      int x=Query(q);
  q[i]=1;
  if(x==1){
    st=i;}
    }

    vector<int>ans;
    ans.push_back(st);
    vector<int>comp;
    for(int i=0;i<n;i++){
        if(i!=st){
            comp.push_back(i);
        }
    }
    while(comp.size()){
        int s=0; int en=comp.size()-1;

        while(s<=en){
            int mid=(s+en)/2;

            vector<int>Q(n,0);
            for(int j=0;j<=mid;j++){
                Q[comp[j]]=1;

            }
            int x=Query(Q);
            Q[ans.back()]=1;
            int y=Query(Q);
            if(y==x){
                en=mid-1;
            }else{
             s=mid+1;
            }

        }
        ans.push_back(comp[s]);
          swap(comp[s], comp.back());
        comp.pop_back();


    }
    for(auto &it:ans){it++;

    }
    Answer(ans);

}

Compilation message

/usr/bin/ld: /tmp/cc5WqZVT.o: in function `Query(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0xc0): multiple definition of `Query(std::vector<int, std::allocator<int> > const&)'; /tmp/ccOVqFRQ.o:grader.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/cc5WqZVT.o:(.bss+0x0): multiple definition of `__my_judge_::judge'; /tmp/ccOVqFRQ.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/cc5WqZVT.o: in function `Answer(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0xe0): multiple definition of `Answer(std::vector<int, std::allocator<int> > const&)'; /tmp/ccOVqFRQ.o:grader.cpp:(.text+0xe0): first defined here
/usr/bin/ld: /tmp/cc5WqZVT.o: in function `main':
library.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccOVqFRQ.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status