QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#107919 | #2829. Cryptography | l1924365846 | TL | 0ms | 0kb | C++14 | 2.7kb | 2023-05-23 09:41:12 | 2023-05-23 09:41:16 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <set>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define int ll
#define ms(a,b) memset((a),(b),sizeof(a))
#define mc(a,b) memcpy((a),(b),sizeof(a))
#define PI acos(-1)
#define ssin(x) sin(x*PI/180.00)
#define ccos(x) cos(x*PI/180.00)
#define ttan(X) tan(x*PI/180.00)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, n, a) for (int i = n - 1; i >= a; i--)
#define IOS ios::sync_with_stdio(false)
#define si(x) scanf("%d",&x)
#define sii(x, y) scanf("%d %d",&x, &y)
#define siii(x, y, z) scanf("%d %d %d",&x, &y, &z)
#define siiii(x, y, z, w) scanf("%d %d %d %d",&x, &y, &z, &w)
#define sl(x) scanf("%lld",&x)
#define sll(x, y) scanf("%lld %lld",&x, &y)
#define slll(x, y, z) scanf("%lld %lld %lld",&x, &y, &z)
#define sllll(x, y, z, w) scanf("%lld %lld %lld %lld",&x, &y, &z, &w)
#define pr(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define sd(x) scanf("%lf",&x)
#define sdd(x, y) scanf("%lf %lf",&x, &y)
#define sddd(x, y, z) scanf("%lf %lf %lf",&x, &y, &z)
#define sdddd(x, y, z, w) scanf("%lf %lf %lf %lf",&x, &y, &z, &w)
#define fi first
#define se second
#define pb push_back
#define mk make_mair
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> PII;
const int mod = 998244353;
const int P = 131;
const int N = 1e5 + 10, M = 3e6 + 10;
const int inf = 0x3f3f3f3f;
const ll lnf = 9e18;
const double eps = 1e-6;
int m, q;
int f[N], g[N], h[N];
int qmi (int a, int b) {
int res = 1;
while (b) {
if (b & 1)
res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
//int check(int a,int b,int &x,int &y){
//
//}
void solve() {
while (scanf ("%lld %lld", &m, &q) ) {
int n = qmi (2, m);
for (int i = 0; i < n; i ++) {
sl (f[i]);
}
for (int i = 0; i < n; i ++) {
sl (g[i]);
}
for (int i = 0; i < n; i ++) {
sl (h[i]);
}
while (q--) {
int a, b, x = -1, y = -1;
sll (a, b);
for (int i = 0; i < 100; i ++) {
for (int j = 0; j < 100; j ++) {
int w = j ^ g[i ^ f[j]];
int ww = i ^ f[j] ^ h[j ^ g[i ^ f[j]]];
if (w == a && ww == b) {
x = i, y = j;
break;
}
}
}
printf ("%lld %lld\n", x, y);
}
}
}
signed main() {
// IOS;
// cin.tie (0);
// cout.tie (0);
int T (1);
// sl (T);
while ( T-- ) {
solve();
}
return 0;
}
/*
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
2 100
0 1 2 3
1 2 3 0
2 3 0 1
0 1
2 3
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...