Submission #710423

# Submission time Handle Problem Language Result Execution time Memory
710423 2023-03-15T08:32:21 Z Darren0724 Minerals (JOI19_minerals) C++17
Compilation error
0 ms 0 KB
#include "minerals.h"
#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> v;
void dc(vector<int> &a,vector<int> &c){
    //cout<<a.size()<<' '<<c.size()<<endl;
    if(a.size()==1){
        v[a[0]]=c[0];
        return;
    }
    int t=0;
    int m=a.size()/2;
    for(int i=0;i<m;i++){
        t=Query(a[i]);
    }
    vector<int> c1,c2;
    for(int i:c){
        int t1=Query(i);
        if(t1!=t){
            Query(i);
            c2.push_back(i);
        }
        else{
            c1.push_back(i);
        }
    }
    for(int i:c1){
        Query(i);
    }
    for(int i=0;i<m;i++){
        t=Query(a[i]);
    }
    vector<int> a1,a2;
    for(int i=0;i<m;i++){
        a1.push_back(a[i]);
    }
    for(int i=m;i<a.size();i++){
        a2.push_back(a[i]);
    }
    dc(a1,c1);
    dc(a2,c2);
}
void Solve(int N) {
    n=N;
    vector<int> a;
    vector<int> c;
    int t=0;
    for(int i=1;i<=N*2;i++){
        int t1=Query(i);
        if(t1!=t){
            a.push_back(i);
            t++;
        }
        else{
            c.push_back(i);
            Query(i);
        }
    }
    for(int i:a){
        Query(i);
    }
    v.resize(N*2+1,-1);
    dc(a,c);
    for(int i=1;i<=n*2;i++){
        if(v[i]!=-1)Answer(i,v[i]);
    }
}

Compilation message

minerals.cpp: In function 'void dc(std::vector<int>&, std::vector<int>&)':
minerals.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int i=m;i<a.size();i++){
      |                 ~^~~~~~~~~
/usr/bin/ld: /tmp/ccCNjCQE.o: in function `Query(int)':
grader.cpp:(.text+0x30): multiple definition of `Query(int)'; /tmp/cciWzSbB.o:minerals.cpp:(.text+0x30): first defined here
/usr/bin/ld: /tmp/ccCNjCQE.o: in function `Answer(int, int)':
grader.cpp:(.text+0x100): multiple definition of `Answer(int, int)'; /tmp/cciWzSbB.o:minerals.cpp:(.text+0x100): first defined here
/usr/bin/ld: /tmp/ccCNjCQE.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cciWzSbB.o:minerals.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status