QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#336187 | #964. Excluded Min | bachbeo2007 | Compile Error | / | / | C++23 | 2.7kb | 2024-02-24 13:50:32 | 2024-02-24 13:50:33 |
Judging History
This is the latest submission verdict.
- [2024-02-24 13:50:33]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-02-24 13:50:32]
- Submitted
answer
// Judges with GCC >= 12 only needs Ofast
// #pragma GCC optimize("O3,no-stack-protector,fast-math,unroll-loops,tree-vectorize")
// MLE optimization
// #pragma GCC optimize("conserve-stack")
// Old judges
// #pragma GCC target("sse4.2,popcnt,lzcnt,abm,mmx,fma,bmi,bmi2")
// New judges. Test with assert(__builtin_cpu_supports("avx2"));
// #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
// Atcoder
// #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma")
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
- insert(x),erase(x)
- find_by_order(k): return iterator to the k-th smallest element
- order_of_key(x): the number of elements that are strictly smaller
*/
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma")
#include<bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_real_distribution<> pp(0.0,1.0);
#define ld long double
#define pii pair<int,int>
#define piii pair<int,pii>
#define mpp make_pair
#define fi first
#define se second
const int mod=998244353;
const int maxn=500005;
const int B=1000;
const int maxs=655;
const int maxm=200005;
const int maxq=1000005;
const int maxl=25;
const int maxa=500000;
const int root=3;
const int base=101;
int n,q,a[maxn];
int l[maxn],r[maxn],res[maxn];
vector<int> pos[maxn],qq[maxn];
/*
int bit[maxn];
void update(int x,int val){
for(int i=x;i<=n;i+=(i&(-i))) bit[i]+=val;
}
int query(int x){
int ans=0;
for(int i=x;i>=1;i-=(i&(-i))) ans+=bit[i];
return ans;
}
*/
int pre[maxn],add[maxn];
int query(int x){
return pre[x]+add[x/B];
}
void update(int x,int val){
for(int i=x;i<=n;i++){
if(i%B==0) add[i/B]+=val,i+=B-1;
else pre[i]+=val;
}
}
void solve(){
cin >> n >> q;
for(int i=1;i<=n;i++){
cin >> a[i];
pos[a[i]].push_back(i);
}
for(int i=1;i<=q;i++){
cin >> l[i] >> r[i];
qq[r[i]-l[i]].push_back(i);
}
for(int i=0;i<=n;i++) for(int x:pos[i]) pre[x]=1;
for(int i=1;i<=n;i++) pre[i]+=pre[i-1];
for(int i=n;i>=0;i--){
for(auto id:qq[i]){
int total=query(r[id])-query(l[id]-1);
if(total>i) res[id]=i+1;
else if(total) qq[total-1].push_back(id);
}
for(int x:pos[i]) update(x,-1);
}
for(int i=1;i<=q;i++) cout << res[i] << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
int test=1;//cin >> test;
while(test--) solve();
}
詳細信息
In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:22: /usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/vector:66, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53: /usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here 133 | struct _Vector_impl | ^~~~~~~~~~~~