QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#704484#238. Distinct ValuesTheZoneCompile Error//C++201.4kb2024-11-02 20:04:412024-11-02 20:04:42

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 20:04:42]
  • 评测
  • [2024-11-02 20:04:41]
  • 提交

answer

#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define N 100010
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define drep(i,r,l) for(int i=r;i>=l;i--)
using namespace std;
int rd() {
	int res=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') f*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
	return res*f;
}
int T;
int n,m;
struct info {
	int l,r;
}A[N];
bool cmp(info x,info y) {
	if(x.l^y.l)return x.l<y.l;
	return x.r<y.r;
}
priority_queue<int,vector<int>,greater<int> >Q;
int Ans[N];
int main() {
	T=rd();
	while(T--) {
		n=rd(),m=rd();
		for(int i=1; i<=m; ++i)A[i].l=rd(),A[i].r=rd();
		sort(A+1,A+m+1,cmp);
		for(int i=1; i<=n; ++i)Q.push(i); 
		for(int i=1; i<A[1].l; ++i)Ans[i]=1;
		int lx=A[1].l,rx=A[1].l;
		for(int i=1; i<=m; ++i) {
			while(A[i].l>lx) {
				if(Ans[lx])Q.push(Ans[lx]),++lx;
				else Ans[lx]=1,++lx;
			}
			if(rx<lx)rx=lx;
			while(rx<=A[i].r)Ans[rx]=Q.top(),Q.pop(),++rx;
		}
		while(rx<=n)Ans[rx]=1,++rx;
		while(!Q.empty())Q.pop();
		for(int i=1; i<n; ++i)printf("%d ",Ans[i]);
		printf("%d\n",Ans[n]); 
		for(int i=1; i<=n; ++i)Ans[i]=0;
	}
	return 0;
}

詳細信息

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:5:
/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
      |              ^~~~~~~~~~~~