QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21861 | #2831. Game Theory | 1145141919810# | Compile Error | / | / | C++20 | 4.5kb | 2022-03-08 17:01:35 | 2022-05-18 04:12:22 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-05-18 04:12:22]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-03-08 17:01:35]
- 提交
answer
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#include<vector>
#include<map>
#include<bitset>
#include<set>
#include<cmath>
#include<ctime>
#include<random>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define bc(x) __builtin_popcount(x)
#define re register
#define il inline
#define pii pair<int,int>
#define pil pair<int,long long>
#define pll pair<long long,long long>
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n';
// #pragma GCC optimize(3)
#define int long long
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
namespace IO_BUFF{
mt19937 rnd(time(0)^(ll)(new char));
int rend(int x){
return rnd()%x+1;
}
void rendom_shuffle(int *a,int len){
shuffle(a+1,a+len+1,rnd);
}
const int BS=(1<<24)+5;char Buffer[BS],*HD,*TL;
inline int gc(){
if(HD==TL) TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);
return (HD==TL)?EOF:*HD++;
}
inline int inn(){
int x,ch,s=1;while((ch=gc())<'0'||ch>'9')if(ch=='-')s=-1;x=ch^'0';
while((ch=gc())>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^'0');return x*s;
}
char ssss[19999999],tttt[20];int ssl,ttl;
inline int print(int x)
{
if(x<0)ssss[++ssl]='-',x=(-x);
if(!x) ssss[++ssl]='0';for(ttl=0;x;x/=10) tttt[++ttl]=char(x%10+'0');
for(;ttl;ttl--) ssss[++ssl]=tttt[ttl];return ssss[++ssl]='\n';
}
inline int Flush(){return fwrite(ssss+1,sizeof(char),ssl,stdout),ssl=0,0;}
int read(){
char c=getchar();int x=1;int s=0;
while(c<'0' || c>'9'){if(c=='-')x=-1;c=getchar();}
while(c>='0' && c<='9'){
s=s*10+c-'0';c=getchar();
}
return s*x;
}
}using namespace IO_BUFF;
namespace CFConTest{
const int mod=998244353;
inline int add(const int &x,const int &y){
return (x+y>=mod?x+y-mod:x+y);
}
inline int del(const int &x,const int &y){
return (x-y<0?x-y+mod:x-y);
}
int ksm(int x,int k){
int base=1;
while(k){
if(k&1)base=1ll*base*x%mod;
k>>=1;
x=1ll*x*x%mod;
}
return base;
}
};
using namespace CFConTest;
const int N=4e5+5;
int n,m,a[N],l[N],r[N];
char c[N];
int sa[N*4],sb[N*4],tag[N*4];
int ta[N*4],tb[N*4];
#define ls (u<<1)
#define rs (u<<1|1)
#define mid ((l+r)>>1)
void pushdown(int u){
if(!tag[u])return ;
tag[ls]^=tag[u];
tag[rs]^=tag[u];
swap(sa[ls],sb[ls]);
swap(sa[rs],sb[rs]);
int x=ta[ls],y=tb[ls];
ta[ls]=(mod-y);
tb[ls]=(mod-x);
int xx=ta[rs],yy=tb[rs];
ta[rs]=(mod-yy);
tb[rs]=(mod-xx);
tag[u]=0;
}
void update(int u){
sa[u]=add(sa[ls],sa[rs]);
sb[u]=add(sb[ls],sb[rs]);
ta[u]=add(ta[ls],ta[rs]);
tb[u]=add(tb[ls],tb[rs]);
}
void add(int u,int l,int r,int L,int R){
if(L<=l && R>=r){
tag[u]^=1;
swap(sa[u],sb[u]);
int x=ta[u]; // \sum -i
int y=tb[u]; // \sum u
tb[u]=mod-x;
ta[u]=mod-y;
return ;
}
pushdown(u);
if(L<=mid)add(ls,l,mid,L,R);
if(R>mid)add(rs,mid+1,r,L,R);
update(u);
}
int querya(int u,int l,int r,int L,int R){
if(L>R)return 0;
if(L<=l && R>=r){
return ta[u];
}
pushdown(u);
if(R<=mid)return querya(ls,l,mid,L,R);
if(L>mid)return querya(rs,mid+1,r,L,R);
return add(querya(ls,l,mid,L,R),querya(rs,mid+1,r,L,R));
}
int queryb(int u,int l,int r,int L,int R){
if(L>R)return 0;
if(L<=l && R>=r){
return tb[u];
}
pushdown(u);
if(R<=mid)return queryb(ls,l,mid,L,R);
if(L>mid)return queryb(rs,mid+1,r,L,R);
return add(queryb(ls,l,mid,L,R),queryb(rs,mid+1,r,L,R));
}
void build(int u,int l,int r){
tag[u]=sa[u]=sb[u]=ta[u]=tb[u]=0;
if(l==r){
ta[u]=tb[u]=sa[u]=sb[u]=0;
if(a[l]==0)sa[u]=1,ta[u]=-l;
else sb[u]=1,tb[u]=l;
return ;
}
build(ls,l,mid);
build(rs,mid+1,r);
update(u);
}
signed main(){
#ifdef newbiewzs
freopen("data.in","r",stdin);
// freopen("std.out","w",stdout);
#else
#endif
int cnt=0;
while(cin>>n){
cnt++;
// cout<<cnt<<'\n';
scanf("%d",&m);
scanf("%s",c+1);
for(int i=1;i<=n;i++)a[i]=c[i]-'0';
build(1,1,n);
for(int i=1;i<=m;i++){
scanf("%d%d",&l[i],&r[i]);
if(i==4){
new char;
}
add(1,1,n,l[i],r[i]);
int u=sb[1];
if(u>n || u+1<1){
cerr<<"fck";
return 0;
}
int ans=add(add(querya(1,1,n,1,u),queryb(1,1,n,u+1,n))*2ll%mod,u);
cout<<(ans%mod+mod)%mod<<'\n';
}
}
return 0;
}
詳細信息
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/gthr.h:148, from /usr/include/c++/11/ext/atomicity.h:35, from /usr/include/c++/11/bits/ios_base.h:39, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from answer.code:4: /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:102:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 102 | __gthrw(pthread_once) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:102:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:103:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 103 | __gthrw(pthread_getspecific) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:103:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:104:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 104 | __gthrw(pthread_setspecific) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:104:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:106:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 106 | __gthrw(pthread_create) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:106:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:107:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 107 | __gthrw(pthread_join) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:107:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:108:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 108 | __gthrw(pthread_equal) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:108:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:109:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 109 | __gthrw(pthread_self) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:109:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:110:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 110 | __gthrw(pthread_detach) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:110:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:112:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 112 | __gthrw(pthread_cancel) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:112:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:114:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 114 | __gthrw(sched_yield) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:114:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:116:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 116 | __gthrw(pthread_mutex_lock) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:116:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:117:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 117 | __gthrw(pthread_mutex_trylock) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:117:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:119:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 119 | __gthrw(pthread_mutex_timedlock) | ^~~~~~~ /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:119:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:121:1: error: attribute value ‘tune=native’ was already specified in ‘target’ attribute 121 | __gthrw(pthread_mutex_unlock) |...