QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#668363 | #9302. Caesar Cipher | 4eyebird# | RE | 2ms | 4196kb | C++17 | 1.9kb | 2024-10-23 13:57:17 | 2024-10-23 13:57:19 |
Judging History
answer
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define Buff ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
//#define int long long
constexpr int NB = 500000;
typedef bitset<NB> bt;
bt a[16];
bt x1, x2;
void solve()
{
int n, m;
cin >> n >> m;
x1.reset();
x1.set(0);
for (int i = 0; i < n; i++)
{
int x, j = 0;
cin >> x;
while (x > 0)
{
if (x & 1)
a[j] |= x1;
j++;
x >>= 1;
}
x1 <<= 1;
}
while (m--)
{
int o;
cin >> o;
if (o == 1)
{
int l, r;
cin >> l >> r;
x1.set();
x1 >>= (NB - (r - l + 1));
x1 <<= (l - 1);
int i = 0;
while (x1.any())
{
x2 = x1;
x1 &= a[i];
a[i] ^= x2;
i++;
}
}
else if (o == 2)
{
int l1, l2, len;
cin >> l1 >> l2 >> len;
bool ok = true;
for (int i = 0; i < 16; i++)
{
x1 = ((a[i] >> (l1 - 1)) << (NB - len));
x1 ^= ((a[i] >> (l2 - 1)) << (NB - len));
if (x1.any())
{
ok = false;
break;
}
}
if (ok)
cout << "yes\n";
else
cout << "no\n";
}
}
}
signed main()
{
Buff;
int _T_ = 1;
// cin >> _T_;
while (_T_--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 4196kb
input:
5 6 1 2 1 2 1 2 1 2 2 2 1 3 3 1 1 1 1 3 5 2 1 2 4 2 1 2 2
output:
no yes no yes
result:
ok 4 token(s): yes count is 2, no count is 2
Test #2:
score: -100
Runtime Error
input:
3 3 0 65535 65535 2 1 2 2 1 2 3 2 1 2 2