QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#668363#9302. Caesar Cipher4eyebird#RE 2ms4196kbC++171.9kb2024-10-23 13:57:172024-10-23 13:57:19

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 17:10:09]
  • hack成功,自动添加数据
  • (/hack/1110)
  • [2024-10-23 13:57:19]
  • 评测
  • 测评结果:RE
  • 用时:2ms
  • 内存:4196kb
  • [2024-10-23 13:57:17]
  • 提交

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

output:


result: