QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#852560#2351. Lost in Transferthanhs0 0ms0kbC++203.0kb2025-01-11 12:45:552025-01-11 12:45:55

Judging History

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

  • [2025-01-11 12:45:55]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2025-01-11 12:45:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define name "TENBAI"
#define fi first
#define se second
#define int long long
#define endl '\n'
#define setmin(x, y) x = min((x), (y))
#define setmax(x, y) x = max((x), (y))
#define sqr(x) ((x) * (x))

mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count());
int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);}



void solve()
{
    string _;
    cin >> _;
    if (_ == "transmit")
    {
        int q;
        cin >> q;
        while (q--)
        {
            deque<int> v;
            int n, xr = 0;
            cin >> n;
            for (int i = 1; i <= n; i++)
            {
                int x;
                cin >> x;
                v.push_back(x);
                xr ^= x;
            }
            sort(v.begin(), v.end());
            vector<int> res;
            for (int i = 0; i < 9; i++)
            {
                int t = xr >> i & 1;
                if (t)
                {
                    res.push_back(v.back());
                    v.pop_back();
                    res.push_back(v.back());
                    v.pop_back();
                }
                else
                {
                    res.push_back(v.front());
                    v.pop_front();
                    res.push_back(v.front());
                    v.pop_front();
                }
            }
            for (int t : v)
                res.push_back(t);
            cout << bitset<9>(xr) << endl;
            for (int i = 1; i < n; i++)
                cout << (res[i] < res[i - 1]);
            cout << endl;
            for (int t : res)
                cout << t << ' ';
            cout << endl;
        }
    }
    else
    {
        int q;
        cin >> q;
        while (q--)
        {
            vector<int> a;
            int n;
            cin >> n;
            int xr = 0;
            for (int i = 1; i <= n; i++)
            {
                int x;
                cin >> x;
                a.push_back(x);
                xr ^= x;
            }
            // for (int i = 1; i < n; i++)
            //     cout <<
            // for (int i = 0; i < 9; i++)
            //     cout << (a[i << 1 | 1] < a[i << 1]);
            for (int i = 0; i < 9; i++)
                xr ^= (a[i << 1 | 1] < a[i << 1]) << i;
            if (xr)
                a.push_back(xr);
            for (int t : a)
                cout << t << ' ';
            cout << endl;
        }
    }
}

signed main()
{
    if (fopen("in.txt", "r")) 
    {
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
    else if (fopen(name".inp", "r"))
    {
        freopen(name".inp", "r", stdin);
        freopen(name".out", "w", stdout);
    }
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int tc = 1; 
    // cin >> tc;
    while (tc--)
        solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer

input:

transmit
2
20 97 388 459 467 32 99 98 296 403 325 330 271 87 333 378 267 405 58 426 374
20 125 481 451 150 495 136 444 192 118 26 68 281 120 61 494 339 86 292 100 32

output:

001111111
1111111111111100000
467 459 426 405 403 388 378 374 333 330 325 296 271 267 32 58 87 97 98 99 
000101101
1100111100110000000
495 494 26 32 481 451 444 339 61 68 292 281 86 100 118 120 125 136 150 192 

input:


output:


result:

wrong output format Expected integer, but "001111111" found (test case 1)