QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321968#4830. Transfer of Dutytuanlinh1230 0ms3920kbC++201.2kb2024-02-06 00:00:322024-02-06 00:00:32

Judging History

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

  • [2024-02-06 00:00:32]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3920kb
  • [2024-02-06 00:00:32]
  • 提交

answer

#include<bits/stdc++.h>
#define ll unsigned long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;

map <ll, bool> A[1005];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    auto calc=[&](ll r0, ll r1, ll r2, ll r3)
    {
        if (!r0 && !r1 && !r2 && !r3) return (string)"0";
        if (r1==r0*r0 && r2==r0*r0*r0 && r3==r1*r1) return to_string(r0);
        return (string)"-1";
    };
    string s; cin >> s;
    if (s=="start")
    {
        ll n; cin >> n;
        ll r0=0, r1=0, r2=0, r3=0;
        for (ll i=1; i<=n; i++)
        {
            ll x; cin >> x;
            r0^=x, r1^=x*x, r2^=x*x*x, r3^=x*x*x*x;
            cout << calc(r0, r1, r2, r3) << "\n";
        }
        cout << r0 << " " << r1 << "\n";
    }
    else
    {
        ll r0, r1, r2, r3; cin >> r0 >> r1 >> r2 >> r3;
        ll n; cin >> n;
        for (ll i=1; i<=n; i++)
        {
            ll x; cin >> x;
            r0^=x, r1^=x*x, r2^=x*x*x, r3^=x*x*x*x;
            cout << calc(r0, r1, r2, r3) << "\n";
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3920kb

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
8 48

input:

resume
8 48
6
14
277
12
10
277
12

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

wrong answer