QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#537083#3726. 2017 RevengesudokuAC ✓256ms3864kbC++17587b2024-08-29 20:01:072024-08-29 20:01:07

Judging History

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

  • [2024-08-29 20:01:07]
  • 评测
  • 测评结果:AC
  • 用时:256ms
  • 内存:3864kb
  • [2024-08-29 20:01:07]
  • 提交

answer

#include<cstdio>
#include<bitset>
#include<iostream>
using namespace std;
bitset<2016>f;
int n,a[2000005],r,I[2020];
int main(){
    //freopen("yuangen.in","r",stdin);
    int pw=1;
    for(int i=1;i<2017;++i){
        pw=(pw*5)%2017;
        I[pw]=i;
    }
    I[1]=0;
    while(scanf("%d%d",&n,&r)!=EOF){
        f.reset();
        f.set(I[1]);
        for(int i=1;i<=n;++i){
            scanf("%d",&a[i]);
        }
        for(int i=1;i<=n;++i){
            f^=((f<<I[a[i]])^(f>>(2016-I[a[i]])));
        }
        cout<<f[I[r]]<<endl;
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 256ms
memory: 3864kb

input:

100 1171
578 632 785 1616 1075 1864 248 1734 662 970 200 1376 1302 1565 220 1821 1869 361 1034 1642 1915 425 635 705 960 1733 1125 701 1326 61 216 1185 1562 576 1721 1605 29 1065 1622 31 263 420 1426 1772 838 767 1920 1802 563 241 1613 1556 1675 1382 1558 667 996 1079 1702 1074 1361 1482 1989 1329 1...

output:

1
0
0
1
1
0
0
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
0
0
1
0
1
0
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
1
1
0
1
0
0
1
0
0
0
0
1
1
0
1
0
1
1
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
1
0
1
1
0
0
...

result:

ok 20000 numbers