Submission #1118910

#TimeUsernameProblemLanguageResultExecution timeMemory
1118910thangdz2k7Minerals (JOI19_minerals)C++17
Compilation error
0 ms0 KiB
// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
//#include "minerals.h"
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int N = 2e5 + 5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

int rt[N], sz = 0;

void dnc(vector <int> p, int L, int R){
    if (p.empty()) return;
    if (L == R) {
        rt[p[0]] = L;
        return;
    }

    vector <int> lf, rg;
    int mid = L + R >> 1;
    for (int i = L; i <= mid; ++ i) Query(i), ++ sz;

    for (int id : p){
        if (Query(id) == sz) lf.push_back(id);
        else rg.push_back(id);
        ++ sz;
    }

    for (int id : p){
        Query(id); -- sz;
    }

    dnc(rg, mid + 1, R);
    for (int i = L; i <= mid; ++ i) Query(i), sz --;
    dnc(lf, l, mid);
}

void solve(){
    int n; cin >> n;
    vector <int> cur(n);
    iota(cur.begin(), cur.end(), 1);
    dnc(cur, n + 1, n + n);

    for (int i = 1; i <= n; ++ i) Answer(i, rt[i]);
}

//void solve(){
//
//}
//
//int main(){
//    if (fopen("pqh.inp", "r")){
//        freopen("pqh.inp", "r", stdin);
//        freopen("pqh.out", "w", stdout);
//    }
//    ios_base::sync_with_stdio(0);
//    cin.tie(0); cout.tie(0);
//
//    int t = 1; // cin >> t;
//    while (t --) solve();
//    return 0;
//}

Compilation message (stderr)

minerals.cpp:19:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
minerals.cpp:19:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
minerals.cpp:20:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
minerals.cpp:20:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
minerals.cpp: In function 'void dnc(std::vector<int>, int, int)':
minerals.cpp:32:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   32 |     int mid = L + R >> 1;
      |               ~~^~~
minerals.cpp:33:37: error: 'Query' was not declared in this scope
   33 |     for (int i = L; i <= mid; ++ i) Query(i), ++ sz;
      |                                     ^~~~~
minerals.cpp:36:13: error: 'Query' was not declared in this scope
   36 |         if (Query(id) == sz) lf.push_back(id);
      |             ^~~~~
minerals.cpp:42:9: error: 'Query' was not declared in this scope
   42 |         Query(id); -- sz;
      |         ^~~~~
minerals.cpp:46:37: error: 'Query' was not declared in this scope
   46 |     for (int i = L; i <= mid; ++ i) Query(i), sz --;
      |                                     ^~~~~
minerals.cpp:47:13: error: 'l' was not declared in this scope; did you mean 'lf'?
   47 |     dnc(lf, l, mid);
      |             ^
      |             lf
minerals.cpp: In function 'void solve()':
minerals.cpp:56:35: error: 'Answer' was not declared in this scope
   56 |     for (int i = 1; i <= n; ++ i) Answer(i, rt[i]);
      |                                   ^~~~~~