Submission #1020108

# Submission time Handle Problem Language Result Execution time Memory
1020108 2024-07-11T15:00:57 Z tengiz05 Minerals (JOI19_minerals) C++17
Compilation error
0 ms 0 KB
#include "minerals.h"
#include <bits/stdc++.h>
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
template<class S,class T>
bool chmin(S &a,const T &b) {
	return a>b?(a=b)==b:false;
}
template<class S,class T>
bool chmax(S &a,const T &b) {
	return a<b?(a=b)==b:false;
}
const ll N=1e5+5;
vll l,r;
vector<bool> vis(N);
pll ans;
ll x;
bool f[N*2];
void dnc(vll l,vll r){
    if(l.sz==1){
        Answer(l[0],r[0]);
        return;
    }
    ld d=l.sz*382.0/1000.0;
    ll m=d,i,j;
    chmax(m,1);
    vll nl,nr,nl2,nr2;
    for(i=0;i<m;i++) {
        nl.pb(l[i]);
        x=Query(l[i]);
    }
    for(i=m;i<l.sz;i++){
        nl2.pb(l[i]);
    }
    for(i=0;i<r.sz-1;i++){
        ll y=Query(r[i]);
        if(y==x)nr.pb(r[i]);
        else nr2.pb(r[i]);
        x=y;
    }
    if(nr.sz<nl.sz)nr.pb(r.bc);
    else nr2.pb(r.bc);
    dnc(nl,nr);
    dnc(nl2,nr2);
}
void Solve(int n) {
    ll i,j;
    for(i=1;i<=n*2;i++){
        ll y=Query(i);
        f[i]=1;
        if(x==y)r.pb(i);
        else l.pb(i);
        x=y;
    }
    dnc(l,r);

}
/*
4
1 5
2 6
3 4
7 8
*/
























Compilation message

minerals.cpp:19:13: error: 'vector' does not name a type
   19 | #define vll vector<ll>
      |             ^~~~~~
minerals.cpp:32:1: note: in expansion of macro 'vll'
   32 | vll l,r;
      | ^~~
minerals.cpp:33:1: error: 'vector' does not name a type
   33 | vector<bool> vis(N);
      | ^~~~~~
minerals.cpp:22:13: error: 'vector' does not name a type
   22 | #define pll vector<pair<ll,ll>>
      |             ^~~~~~
minerals.cpp:34:1: note: in expansion of macro 'pll'
   34 | pll ans;
      | ^~~
minerals.cpp:37:6: error: variable or field 'dnc' declared void
   37 | void dnc(vll l,vll r){
      |      ^~~
minerals.cpp:19:13: error: 'vector' was not declared in this scope
   19 | #define vll vector<ll>
      |             ^~~~~~
minerals.cpp:37:10: note: in expansion of macro 'vll'
   37 | void dnc(vll l,vll r){
      |          ^~~
minerals.cpp:19:13: note: suggested alternatives:
   19 | #define vll vector<ll>
      |             ^~~~~~
minerals.cpp:37:10: note: in expansion of macro 'vll'
   37 | void dnc(vll l,vll r){
      |          ^~~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from minerals.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from minerals.cpp:2:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
minerals.cpp:3:12: error: expected primary-expression before 'int'
    3 | #define ll int
      |            ^~~
minerals.cpp:19:20: note: in expansion of macro 'll'
   19 | #define vll vector<ll>
      |                    ^~
minerals.cpp:37:10: note: in expansion of macro 'vll'
   37 | void dnc(vll l,vll r){
      |          ^~~
minerals.cpp:19:13: error: 'vector' was not declared in this scope
   19 | #define vll vector<ll>
      |             ^~~~~~
minerals.cpp:37:16: note: in expansion of macro 'vll'
   37 | void dnc(vll l,vll r){
      |                ^~~
minerals.cpp:19:13: note: suggested alternatives:
   19 | #define vll vector<ll>
      |             ^~~~~~
minerals.cpp:37:16: note: in expansion of macro 'vll'
   37 | void dnc(vll l,vll r){
      |                ^~~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from minerals.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from minerals.cpp:2:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
minerals.cpp:3:12: error: expected primary-expression before 'int'
    3 | #define ll int
      |            ^~~
minerals.cpp:19:20: note: in expansion of macro 'll'
   19 | #define vll vector<ll>
      |                    ^~
minerals.cpp:37:16: note: in expansion of macro 'vll'
   37 | void dnc(vll l,vll r){
      |                ^~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:69:17: error: 'r' was not declared in this scope
   69 |         if(x==y)r.pb(i);
      |                 ^
minerals.cpp:70:14: error: 'l' was not declared in this scope
   70 |         else l.pb(i);
      |              ^
minerals.cpp:73:9: error: 'l' was not declared in this scope
   73 |     dnc(l,r);
      |         ^
minerals.cpp:73:11: error: 'r' was not declared in this scope
   73 |     dnc(l,r);
      |           ^
minerals.cpp:73:5: error: 'dnc' was not declared in this scope
   73 |     dnc(l,r);
      |     ^~~
minerals.cpp:65:10: warning: unused variable 'j' [-Wunused-variable]
   65 |     ll i,j;
      |          ^