Submission #1077652

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

int solv(vector <int> v, int pval, bool ud){
    int sz=v.size();
    assert(sz%2==0);
    if(sz==2){
        Answer(v[0], v[1]);
        return pval;
    }
    int mid=sz/4;
    vector <int> nv1, nv2;
    for(int i=0;i<sz;i++){
        int now=Query(v[i]);
        if((ud && now>pval+mid) || (!ud && now<pval-mid)){
            nv1.push_back(v[i]);
            Query(v[i]);
        }
        else{
            nv2.push_back(v[i]);
        }
    }
    int nxtv=solv(nv1, pval+(ud ? mid : -mid), ud);
    return solv(nv2, nxtv, ud^1);
}
void Solve(int N) {
    vector <int> v;
    for(int i=1;i<=2*N;i++) v.push_back(i);
    solv(v, 0, 1);
}

Compilation message

minerals.cpp:6:2: error: extended character   is not valid in an identifier
    6 |     int sz=v.size();
      |  ^
minerals.cpp:6:5: error: extended character   is not valid in an identifier
    6 |     int sz=v.size();
      |    ^
minerals.cpp:7:2: error: extended character   is not valid in an identifier
    7 |     assert(sz%2==0);
      |  ^
minerals.cpp:7:5: error: extended character   is not valid in an identifier
    7 |     assert(sz%2==0);
      |    ^
minerals.cpp:8:2: error: extended character   is not valid in an identifier
    8 |     if(sz==2){
      |  ^
minerals.cpp:8:5: error: extended character   is not valid in an identifier
    8 |     if(sz==2){
      |    ^
minerals.cpp: In function 'int solv(std::vector<int>, int, bool)':
minerals.cpp:6:2: error: '\U000000a0' was not declared in this scope
    6 |     int sz=v.size();
      |  ^
minerals.cpp:7:4: error: expected ';' before '\U000000a0assert'
    7 |     assert(sz%2==0);
      |   ^~~~~~~~
      |   ;
minerals.cpp:8:4: error: expected ';' before '\U000000a0if'
    8 |     if(sz==2){
      |   ^~~~
      |   ;
minerals.cpp:12:13: error: 'sz' was not declared in this scope
   12 |     int mid=sz/4;
      |             ^~