提交记录 3462
用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
---|---|---|---|---|---|---|---|
zhouyuyang | noi17a. 【NOI2017】整数 | Accepted | 100 | 440.277 ms | 36048 KB | C++ | 1.54 KB |
提交时间 | 评测时间 |
---|---|
2018-07-15 18:47:29 | 2020-07-31 21:18:14 |
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<set>
#define N 30000005
using namespace std;
const int L=2333333;
char LZH[L],*S=LZH,*T=LZH;
inline char gc(){
if (S==T){
T=(S=LZH)+fread(LZH,1,L,stdin);
if (S==T) return EOF;
}
return *S++;
}
inline int read(){
char ch=gc();
int x=0,f=1;
for (;ch<'0'||ch>'9';ch=gc())
if (ch=='-') f=-1;
for (;ch>='0'&&ch<='9';ch=gc())
x=x*10-48+ch;
return x*f;
}
int n,x,y;
bool fl;
bitset<N> a,b;
struct CMP{
bool operator ()(const int &x,const int &y){
return x>y;
}
};
struct SET{
int cnt[(N>>4)+1];
set<int,CMP> s;
SET(){
s.insert(-1);
memset(cnt,0,sizeof(cnt));
}
void insert(int x){
x+=16; x>>=4;
if (!(cnt[x]++)) s.insert(x);
}
void erase(int x){
x+=16; x>>=4;
if (!(--cnt[x])) s.erase(x);
}
int query(int x){
if (x<0) return -2;
for (int i=x;i>=((x>>4)<<4)&&i>=0;i--)
if (a[i]^b[i]) return i;
int y=*s.lower_bound(x>>4);
if (y==-1) return -2; y=(y-1)<<4;
for (int i=y+15;i>=y&&i>=0;i--)
if (a[i]^b[i]) return i;
return -2;
}
}Set;
void add(){
register bool tg=0;
for (register int i=y;tg||x;i++,x>>=1)
if (tg^(x&1)){
a[i]^b[i]?Set.erase(i):Set.insert(i);
tg=(fl?a[i]:b[i]);
fl?a[i]=1-a[i]:b[i]=1-b[i];
}
else
tg&=(x&1);
}
int main(){
n=read(); read(); read(); read();
Set.insert(-2);
for (int i=1;i<=n;i++)
if (read()==1){
x=read(); y=read();
fl=(x>0); x=(x>0?x:-x);
add();
}
else{
x=read();
y=Set.query(x-1);
putchar((a[x]^b[x]^(y!=-2&&!a[y]))+'0');
puts("");
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 603.19 us | 7 MB + 192 KB | Accepted | Score: 4 | 显示更多 |
Testcase #2 | 620.69 us | 7 MB + 192 KB | Accepted | Score: 4 | 显示更多 |
Testcase #3 | 1.017 ms | 7 MB + 212 KB | Accepted | Score: 4 | 显示更多 |
Testcase #4 | 942.72 us | 7 MB + 232 KB | Accepted | Score: 4 | 显示更多 |
Testcase #5 | 2.26 ms | 7 MB + 280 KB | Accepted | Score: 4 | 显示更多 |
Testcase #6 | 1.192 ms | 7 MB + 284 KB | Accepted | Score: 4 | 显示更多 |
Testcase #7 | 3.387 ms | 7 MB + 564 KB | Accepted | Score: 4 | 显示更多 |
Testcase #8 | 3.297 ms | 7 MB + 368 KB | Accepted | Score: 4 | 显示更多 |
Testcase #9 | 10.487 ms | 8 MB + 436 KB | Accepted | Score: 4 | 显示更多 |
Testcase #10 | 15.753 ms | 8 MB + 484 KB | Accepted | Score: 4 | 显示更多 |
Testcase #11 | 16.883 ms | 8 MB + 252 KB | Accepted | Score: 4 | 显示更多 |
Testcase #12 | 7.788 ms | 8 MB + 864 KB | Accepted | Score: 4 | 显示更多 |
Testcase #13 | 24.212 ms | 10 MB + 76 KB | Accepted | Score: 4 | 显示更多 |
Testcase #14 | 71.575 ms | 14 MB + 600 KB | Accepted | Score: 4 | 显示更多 |
Testcase #15 | 38.817 ms | 13 MB + 996 KB | Accepted | Score: 4 | 显示更多 |
Testcase #16 | 153.366 ms | 19 MB + 776 KB | Accepted | Score: 4 | 显示更多 |
Testcase #17 | 143.314 ms | 11 MB + 252 KB | Accepted | Score: 4 | 显示更多 |
Testcase #18 | 245.332 ms | 24 MB + 940 KB | Accepted | Score: 4 | 显示更多 |
Testcase #19 | 290.327 ms | 27 MB + 504 KB | Accepted | Score: 4 | 显示更多 |
Testcase #20 | 385.695 ms | 29 MB + 92 KB | Accepted | Score: 4 | 显示更多 |
Testcase #21 | 151.994 ms | 23 MB + 84 KB | Accepted | Score: 4 | 显示更多 |
Testcase #22 | 272.773 ms | 12 MB + 840 KB | Accepted | Score: 4 | 显示更多 |
Testcase #23 | 327.237 ms | 18 MB + 420 KB | Accepted | Score: 4 | 显示更多 |
Testcase #24 | 289.305 ms | 13 MB + 48 KB | Accepted | Score: 4 | 显示更多 |
Testcase #25 | 440.277 ms | 35 MB + 208 KB | Accepted | Score: 4 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-22 12:44:16 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠