提交记录 4704
用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
---|---|---|---|---|---|---|---|
orbitingfIea | noi17a. 【NOI2017】整数 | Accepted | 100 | 361.88 ms | 20884 KB | C++11 | 1.25 KB |
提交时间 | 评测时间 |
---|---|
2018-07-30 11:13:04 | 2020-07-31 23:11:05 |
#include<bits/stdc++.h>
using namespace std;
int read(){
static int x, fl; static char c;
x=fl=0; c=getchar();
for (;!(c>='0'&&c<='9');c=getchar()) if (c=='-') fl=1;
for (; (c>='0'&&c<='9');c=getchar()) x=x*10+c-'0';
return fl? -x: x;
}
int n;
#define uint unsigned int
uint a[2][1001000];
set<int>S;
void gao(int who,int p,uint v){
for (;v;++p){
v+=a[who][p];
a[who][p]=v&((1<<30)-1);
v>>=30;
if (a[0][p]!=a[1][p]) S.insert(p);
else S.erase(p);
}
}
void add(int who,uint v,int p){
int bel=p/30, las=p%30;
gao(who,bel,(v&((1<<30-las)-1))<<las);
gao(who,bel+1,v>>30-las);
}
int lower(int p){
if (p<0) return 0;
int bel=p/30, las=p%30, b=(1<<las+1)-1;
if ((a[0][bel]&b)!=(a[1][bel]&b))
return (a[0][bel]&b)<(a[1][bel]&b);
set<int>::iterator it=S.upper_bound(bel-1);
if (it==S.begin()) return 0;
--it; return a[0][*it]<a[1][*it];
}
int cal(int p){
int bel=p/30, las=p%30;
int res=(a[0][bel]>>las&1)^(a[1][bel]>>las&1);
return res^lower(p-1);
}
int main(){
n=read(); read(); read(); read();
int t, p, v;
for (int cas=1;cas<=n;++cas){
t=read();
if (t==1){
v=read(); p=read();
if (v>0) add(0,v,p);
if (v<0) add(1,-v,p);
}else{
p=read();
puts(cal(p)? "1": "0");
}
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 38.19 us | 40 KB | Accepted | Score: 4 | 显示更多 |
Testcase #2 | 53.56 us | 44 KB | Accepted | Score: 4 | 显示更多 |
Testcase #3 | 228.06 us | 44 KB | Accepted | Score: 4 | 显示更多 |
Testcase #4 | 422.19 us | 48 KB | Accepted | Score: 4 | 显示更多 |
Testcase #5 | 633.71 us | 48 KB | Accepted | Score: 4 | 显示更多 |
Testcase #6 | 622.23 us | 64 KB | Accepted | Score: 4 | 显示更多 |
Testcase #7 | 1.318 ms | 232 KB | Accepted | Score: 4 | 显示更多 |
Testcase #8 | 1.148 ms | 68 KB | Accepted | Score: 4 | 显示更多 |
Testcase #9 | 4.708 ms | 672 KB | Accepted | Score: 4 | 显示更多 |
Testcase #10 | 6.533 ms | 396 KB | Accepted | Score: 4 | 显示更多 |
Testcase #11 | 7.341 ms | 192 KB | Accepted | Score: 4 | 显示更多 |
Testcase #12 | 7.211 ms | 1 MB + 36 KB | Accepted | Score: 4 | 显示更多 |
Testcase #13 | 11.869 ms | 1 MB + 472 KB | Accepted | Score: 4 | 显示更多 |
Testcase #14 | 36.878 ms | 4 MB + 132 KB | Accepted | Score: 4 | 显示更多 |
Testcase #15 | 38.301 ms | 4 MB + 640 KB | Accepted | Score: 4 | 显示更多 |
Testcase #16 | 77.986 ms | 8 MB + 208 KB | Accepted | Score: 4 | 显示更多 |
Testcase #17 | 71.728 ms | 1 MB + 232 KB | Accepted | Score: 4 | 显示更多 |
Testcase #18 | 131.342 ms | 12 MB + 288 KB | Accepted | Score: 4 | 显示更多 |
Testcase #19 | 160.199 ms | 14 MB + 308 KB | Accepted | Score: 4 | 显示更多 |
Testcase #20 | 361.88 ms | 18 MB + 256 KB | Accepted | Score: 4 | 显示更多 |
Testcase #21 | 147.549 ms | 13 MB + 804 KB | Accepted | Score: 4 | 显示更多 |
Testcase #22 | 138.214 ms | 2 MB + 244 KB | Accepted | Score: 4 | 显示更多 |
Testcase #23 | 151.331 ms | 6 MB + 360 KB | Accepted | Score: 4 | 显示更多 |
Testcase #24 | 148.201 ms | 2 MB + 392 KB | Accepted | Score: 4 | 显示更多 |
Testcase #25 | 248.773 ms | 20 MB + 404 KB | Accepted | Score: 4 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-22 13:00:30 | Loaded in 2 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠