9981 | 2024-03-22 22:41:22 | RRoli | Xorzótábla | cpp17 | Time limit exceeded 0/100 | 2.098s | 22040 KiB |
#include <bits/stdc++.h>
using namespace std;
int n, m, ln, a[100001], b[100001];
bool c[32];
void valt(int k) {
int p = 0;
for(int t = 1; k > 0; t *= 10) {
if(k % 2 == 1) p += t;
k /= 2;
}
for(int i = 1; p > 0; i++) {
if(i >= ln) ln = i;
if(c[i] xor p%10) c[i] = true;
else c[i] = false;
p /= 10;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= m; i++) cin >> b[i];
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
valt(a[i] + b[j]);
int ki = 0;
for(int i = 1; i <= ln; i++) {
ki += c[i]*pow(2, i-1);
}
cout << ki;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1904 KiB | ||||
2 | Time limit exceeded | 2.098s | 3528 KiB | ||||
subtask2 | 0/14 | ||||||
3 | Wrong answer | 3ms | 4008 KiB | ||||
4 | Wrong answer | 3ms | 3972 KiB | ||||
5 | Wrong answer | 3ms | 3988 KiB | ||||
6 | Wrong answer | 4ms | 4312 KiB | ||||
7 | Wrong answer | 34ms | 4592 KiB | ||||
8 | Wrong answer | 34ms | 4700 KiB | ||||
9 | Wrong answer | 64ms | 4924 KiB | ||||
subtask3 | 0/14 | ||||||
10 | Wrong answer | 3ms | 5148 KiB | ||||
11 | Time limit exceeded | 2.098s | 6476 KiB | ||||
12 | Time limit exceeded | 2.065s | 8028 KiB | ||||
13 | Time limit exceeded | 2.026s | 9836 KiB | ||||
14 | Time limit exceeded | 2.069s | 11708 KiB | ||||
subtask4 | 0/14 | ||||||
15 | Time limit exceeded | 2.069s | 12340 KiB | ||||
16 | Time limit exceeded | 2.072s | 13628 KiB | ||||
17 | Time limit exceeded | 2.053s | 14012 KiB | ||||
18 | Time limit exceeded | 2.045s | 14744 KiB | ||||
19 | Time limit exceeded | 2.046s | 15656 KiB | ||||
subtask5 | 0/21 | ||||||
20 | Time limit exceeded | 2.085s | 16028 KiB | ||||
21 | Time limit exceeded | 2.046s | 15604 KiB | ||||
22 | Time limit exceeded | 2.065s | 16088 KiB | ||||
23 | Time limit exceeded | 2.058s | 16328 KiB | ||||
24 | Time limit exceeded | 2.061s | 16740 KiB | ||||
25 | Time limit exceeded | 2.04s | 16964 KiB | ||||
subtask6 | 0/37 | ||||||
26 | Time limit exceeded | 2.073s | 17260 KiB | ||||
27 | Time limit exceeded | 2.049s | 16768 KiB | ||||
28 | Time limit exceeded | 2.069s | 17220 KiB | ||||
29 | Time limit exceeded | 2.058s | 17684 KiB | ||||
30 | Time limit exceeded | 2.072s | 18780 KiB | ||||
31 | Time limit exceeded | 2.053s | 19640 KiB | ||||
32 | Time limit exceeded | 2.045s | 20476 KiB | ||||
33 | Time limit exceeded | 2.062s | 21116 KiB | ||||
34 | Time limit exceeded | 2.065s | 22040 KiB |