QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21717 | #2829. Cryptography | hy_zheng_zai_nei_juan# | TL | 4ms | 7724kb | C++20 | 1.6kb | 2022-03-08 14:30:43 | 2022-05-08 03:59:10 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<sstream>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define in(x) x=read()
#define qr read()
#define int ll
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace fastIO
{
#define BUF_SIZE 100000
bool IOerror=0;
inline char nc()
{
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
if (pend==p1){IOerror=1;return -1;}
}
return *p1++;
}
inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
inline ll read()
{
bool sign=0; char ch=nc();ll x=0;
for (;blank(ch);ch=nc());
if (IOerror)return 0;
if (ch=='-')sign=1,ch=nc();
for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
if (sign)x=-x;
return x;
}
#undef BUF_SIZE
};
using namespace fastIO;
int f[1000010],g[1000010],h[1000010];
signed main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
int m,q;
ios::sync_with_stdio(0);
while(cin>>m>>q)
{
for(int i=0;i<(1<<m);i++)cin>>f[i];
for(int i=0;i<(1<<m);i++)cin>>g[i];
for(int i=0;i<(1<<m);i++)cin>>h[i];
while(q--)
{
int a,b;
cin>>a>>b;
int now=b^h[a];
int y=g[now]^a;
int x=b^f[y]^h[y^g[now]];
cout<<x<<' '<<y<<'\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 7624kb
input:
2 2 0 1 2 3 1 2 3 0 2 3 0 1 0 1 2 3 1 1 0 0 0 0 0 0 0 0
output:
3 0 1 2 0 0
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 4ms
memory: 7724kb
input:
1 1 0 0 0 0 0 0 0 0
output:
0 0
result:
ok single line: '0 0'
Test #3:
score: -100
Time Limit Exceeded
input:
1 2 1 1 0 0 0 0 1 1 1 0 1 2 0 0 0 1 0 1 1 0 1 1 1 2 0 1 1 0 0 0 1 0 1 0 1 2 0 0 0 1 1 1 0 0 1 1 1 2 0 1 1 0 0 1 0 1 0 0 1 2 1 1 0 1 0 1 1 0 0 0 1 2 1 1 0 1 1 0 1 0 0 1 1 2 0 0 1 0 1 1 1 1 1 1 1 2 1 1 0 1 1 0 1 0 0 1 1 2 0 1 0 0 0 0 0 1 0 1 1 2 1 1 1 0 1 0 1 0 1 1 1 2 1 1 1 0 1 1 0 1 0 0 1 2 1 1 0 1 ...
output:
0 1 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 1 0 0 1 1 0 1 1 1 0 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 ...