QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882199#9183. BouquetI_love_Riley_Andersen#Compile Error//C++112.5kb2025-02-04 22:00:482025-02-04 22:00:49

Judging History

This is the latest submission verdict.

  • [2025-02-04 22:00:49]
  • Judged
  • [2025-02-04 22:00:48]
  • Submitted

answer

#include"bits/stdc++.h"
#include"ext/pb_ds/tree_policy.hpp"
#include"ext/pb_ds/assoc_container.hpp"
using namespace std;
using namespace __gnu_pbds;
#define FOR(i,a,b)for(int i=a;i<b;i++)
#define F0R(i,a)FOR(i,0,a)
#define ROF(i,a,b)for(int i=b-1;a<=i;i--)
#define R0F(i,a)ROF(i,0,a)
#define rep(a)F0R(_,a)
#define each(a,x)for(auto&a:x)
#define all(a)begin(a),end(a)
#define sz(x)int(size(x))
#define lla(x)rbegin(x),rend(x)
#define SUM(a)accumulate(all(a),0ll)
#define SUMM(a,b)accumulate(a,a+b,0ll)
#define MAX(a)*max_element(all(a))
#define MAXX(a,b)*max_element(a,a+b)
#define MIN(a)*min_element(all(a))
#define MINN(a,b)*min_element(a,a+b)
#define con const int
#define lwb lower_bound
#define upb upper_bound
#define bry binary_search
#ifdef LOCAL
#define print(x)cout<<x;
#else
#define print(...)
#endif
#define debug(x)print(#x<<" = "<<x<<endl)
using ld=long double;
using ll=long long;
using str=string;
template<class T>using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>using omset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>T minn(T a){return a;}
template<class T,class...Args>T minn(T a,Args... args){return min(a,minn(args...));}
template<class T>T maxx(T a){return a;}
template<class T,class...Args>T maxx(T a,Args... args){return max(a,maxx(args...));}
#define SMIN(a,b...)a=min(a,minn(b))
#define SMAX(a,b...)a=max(a,maxx(b))
void fileset(str a){assert(nullptr!=freopen((a+".in").c_str(),"r",stdin)&&nullptr!=freopen((a+".out").c_str(),"w",stdout));}
con mxN = 2e5 + 5;

struct fwtree{
    int ar[mxN];

    void upd(int i, int x){
        for (++ i; i < mxN; i += i & -i){
            ar[i] = max(ar[i], x);
        }
    }

    int qry(int i){
        int r = INT_MIN;

        for (++ i; i; i -= i & -i){
            r = max(r, ar[i]);
        }

        return r;
    }
} fw;

int main(){
    int N;
    cin >> N;

    multiset<tuple<int,int,int>> mt;

    int ans = 0;

    FOR (i, 1, N + 1){
        int L, R;
        cin >> L >> R;

        while (sz(mt)){
            auto [k, j, v] = *begin(mt);

            if (k <= i){
                fw.upd(j, v);

                mt.erase(begin(mt));
            } else {
                break;
            }
        }

        int unlock = min(mxN - 1, i + R + 1);
        int loc = fw.qry(max(0, i - L - 1));

        mt.emplace(unlock, i, loc + 1);
        ans = max(ans, loc + 1);
    }

    cout << ans << endl;
}

详细

answer.code: In function ‘int main()’:
answer.code:13:18: error: ‘size’ was not declared in this scope
   13 | #define sz(x)int(size(x))
      |                  ^~~~
answer.code:77:16: note: in expansion of macro ‘sz’
   77 |         while (sz(mt)){
      |                ^~
answer.code:78:18: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   78 |             auto [k, j, v] = *begin(mt);
      |                  ^