QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#106472 | #2072. Junk Problem | zhoukangyang | WA | 2ms | 3456kb | C++17 | 1.2kb | 2023-05-17 21:00:56 | 2023-05-17 21:01:00 |
Judging History
answer
#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector < int >
#define sz(a) ((int) (a).size())
#define ull unsigned long long
#define me(a, x) memset(a, x, sizeof(a))
using namespace std;
const int N = 1e6 + 7;
int n;
int k;
int f;
inline int mul(int x, int y) {
int w = 0;
L(i, 0, k) if(x >> i & 1) w ^= y << i;
R(i, k * 2, k) if(w >> i & 1) w ^= f << (i - k);
return w;
}
mt19937_64 orz(114514);
int ans[N];
int main() {
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
while((4 << (k * 2)) <= n) ++k;
while(true) {
f = (1 << k) + orz() % (1 << k);
int okay = 1;
L(d, 1, min((k + 1) / 2, k - 1)) {
L(z, 0, (1 << d) - 1) {
int cur = f, cp = z + (1 << d);
R(i, k, d)
if(cur >> i & 1)
cur ^= cp << (i - d);
if(!cur) {
okay = 0;
break;
}
}
}
if(okay) break;
}
L(i, 0, (1 << k) - 1)
ans[i] = (i ^ ((1 ^ mul(mul(i, i), i)) << k));
cout << (1 << k) << '\n';
L(i, 0, (1 << k) - 1)
cout << ans[i] << ' ';
cout << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3456kb
input:
49
output:
4 4 1 2 3
result:
ok AC
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3304kb
input:
10000000
output:
2048 2048 1 18434 28675 133124 172037 247814 217095 1050632 1196041 1394698 1519627 1968140 1892365 1755150 1576975 3055632 2500625 3989522 3430419 303124 821269 1531926 2062359 3880984 3272729 2914330 2523163 1914908 1527837 784414 106527 2627616 593953 639010 2684963 1355812 3479589 3467302 140496...
result:
wrong answer Integer parameter [name=m] equals to 2048, violates the range [2236, 10^7]