Submission #1077925

# Submission time Handle Problem Language Result Execution time Memory
1077925 2024-08-27T10:38:04 Z azberjibiou Minerals (JOI19_minerals) C++17
Compilation error
0 ms 0 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;

int ret;
void solv(vector <int> v1, vector <int> v2, int in1, int in2){
    int sz=v2.size();
    if(sz==1){
        Answer(v1[0], v2[0]);
        return;
    }
    vector <int> v11, v12, v21, v22
    int mid=(sz/2);
    for(int i=0;i<mid;i++) ret=Query(v1[i]), v11.push_back(v1[i]);
    for(int i=mid;i<sz;i++) v12.push_back(v2[i]);
    for(int i=0;i<sz;i++){
        int nr=Query(v2[i]);
        if(nr==ret){
            if(in1==1) v22.push_back(v2[i]);
            else v21.push_back(v2[i]);
        }
        else{
            if(in1==1) v21.push_back(v2[i]);
            else v22.push_back(v2[i]);
        }
        ret=nr;
    }
    solv(v11, v21, 1-in1, 1-in2);
    solv(v12, v22, in1, 1-in2);
}
void Solve(int N) {
    if(N==1){
        Answer(1, 2);
        return;
    }
    ret=0;
    vector <int> v1, v2;
    for(int i=1;i<=2*N;i++){
        int nr=Query(i);
        if(nr==ret) v2.push_back(i);
        else v1.push_back(i);
        ret=nr;
    }
    solv(v1, v2, 1, 1);
}

Compilation message

minerals.cpp: In function 'void solv(std::vector<int>, std::vector<int>, int, int)':
minerals.cpp:13:5: error: expected initializer before 'int'
   13 |     int mid=(sz/2);
      |     ^~~
minerals.cpp:14:19: error: 'mid' was not declared in this scope
   14 |     for(int i=0;i<mid;i++) ret=Query(v1[i]), v11.push_back(v1[i]);
      |                   ^~~
minerals.cpp:15:15: error: 'mid' was not declared in this scope
   15 |     for(int i=mid;i<sz;i++) v12.push_back(v2[i]);
      |               ^~~
minerals.cpp:19:24: error: 'v22' was not declared in this scope; did you mean 'v21'?
   19 |             if(in1==1) v22.push_back(v2[i]);
      |                        ^~~
      |                        v21
minerals.cpp:24:18: error: 'v22' was not declared in this scope; did you mean 'v21'?
   24 |             else v22.push_back(v2[i]);
      |                  ^~~
      |                  v21
minerals.cpp:29:15: error: 'v22' was not declared in this scope; did you mean 'v21'?
   29 |     solv(v12, v22, in1, 1-in2);
      |               ^~~
      |               v21