Submission #30258055
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int b[1<<10][1<<10]={0};
int d[(1<<20)+5];
int a[(1<<20)+5];
int e[(1<<20)+5];
void dfs(int n1,int x,int y,int z){
if(n1==1){
b[z][x]^=a[y];
return;
}
int n2=n1/2;
dfs(n2,x+n2,y,z);
dfs(n2,x,y+n2,z);
dfs(n2,x,y,z);
}
void df2(int n1,int x,int y){
if(n1==1){
for(int i=x*(1<<10);i<(x+1)*(1<<10);i++){
e[i]^=b[y][i-x*(1<<10)];
}
return;
}
int n2=n1/2;
df2(n2,x+n2,y);
df2(n2,x,y+n2);
df2(n2,x,y);
}
int main(){
scanf("%d%d",&n,&m);
for(ll i=0;i<n;i++){
scanf("%d",&a[n-1-i]);
}
for(ll j=0;j<m;j++) e[j]=0;
for(int i=0;i<(1<<10);i++){
dfs(1<<10,0,i*(1<<10),i);
}
df2(1<<10,0,0);
for(ll j=0;j<m;j++){
printf("%d ",e[j]);
}
}
Submission Info
| Submission Time |
|
| Task |
D - Prefix XORs |
| User |
dongdziz |
| Language |
C++ (GCC 9.2.1) |
| Score |
700 |
| Code Size |
899 Byte |
| Status |
AC |
| Exec Time |
368 ms |
| Memory |
22552 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:32:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
32 | scanf("%d%d",&n,&m);
| ~~~~~^~~~~~~~~~~~~~
./Main.cpp:34:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
34 | scanf("%d",&a[n-1-i]);
| ~~~~~^~~~~~~~~~~~~~~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
700 / 700 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00-sample-001.txt, 00-sample-002.txt |
| All |
00-sample-001.txt, 00-sample-002.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00-sample-001.txt |
AC |
197 ms |
11736 KiB |
| 00-sample-002.txt |
AC |
194 ms |
11768 KiB |
| 01-001.txt |
AC |
197 ms |
11736 KiB |
| 01-002.txt |
AC |
223 ms |
13088 KiB |
| 01-003.txt |
AC |
238 ms |
14492 KiB |
| 01-004.txt |
AC |
299 ms |
15348 KiB |
| 01-005.txt |
AC |
302 ms |
15268 KiB |
| 01-006.txt |
AC |
343 ms |
21032 KiB |
| 01-007.txt |
AC |
236 ms |
13104 KiB |
| 01-008.txt |
AC |
286 ms |
15352 KiB |
| 01-009.txt |
AC |
367 ms |
22484 KiB |
| 01-010.txt |
AC |
368 ms |
22528 KiB |
| 01-011.txt |
AC |
368 ms |
22492 KiB |
| 01-012.txt |
AC |
366 ms |
22552 KiB |
| 01-013.txt |
AC |
368 ms |
22500 KiB |