QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215049#6549. Two Missing Numbersucup-team1716#0 1ms3528kbC++201.4kb2023-10-15 02:40:202023-10-15 02:40:21

Judging History

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

  • [2023-10-15 02:40:21]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3528kb
  • [2023-10-15 02:40:20]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

    int q, n;
    cin >> q >> n;

    if(q==1)
    {
        ull a[2] = {0, 0};

        unordered_set<ull> odd;

        for(int i=0; i<n; i++)
        {
            ull x;
            cin >> x;

            if(odd.count(x)) odd.erase(x);
            else odd.insert(x);
        }

        int index = 0;
        for(auto &i: odd)
        {
            a[index] = i;
            index++;
        }

        if(odd.size()==1) a[1] = a[0];
        cout << a[0] << " " << a[1];
    }
    else
    {
        ull a, b;
        cin >> a >> b;

        unordered_set<ull> odd;

        for(int i=0; i<n; i++)
        {
            ull x;
            cin >> x;

            if(odd.count(x)) odd.erase(x);
            else odd.insert(x);
        }

        if(a==b)
        {
            if(odd.size()!=2)
            {
                if(odd.count(a)) odd.erase(a);
                else odd.insert(a);
            }
        }
        else
        {
            if(odd.count(a)) odd.erase(a);
            else odd.insert(a);
            if(odd.count(b)) odd.erase(b);
            else odd.insert(b);
        }

        for(auto &i: odd) cout << i << " ";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3528kb

First Run Input

1 5
5 1 4 4 5

First Run Output

1 1

Second Run Input

2 3 1 1
9 9 3 

Second Run Output

1 3 

result:

ok correct

Test #2:

score: 100
Accepted
time: 0ms
memory: 3472kb

First Run Input

1 1
0

First Run Output

0 0

Second Run Input

2 1 0 0
1

Second Run Output

0 1 

result:

ok correct

Test #3:

score: 100
Accepted
time: 1ms
memory: 3476kb

First Run Input

1 1
10625130587464985929

First Run Output

10625130587464985929 10625130587464985929

Second Run Input

2 1 10625130587464985929 10625130587464985929
1167154569617655189

Second Run Output

10625130587464985929 1167154569617655189 

result:

ok correct

Test #4:

score: 100
Accepted
time: 0ms
memory: 3504kb

First Run Input

1 0

First Run Output

0 0

Second Run Input

2 2 0 0
14205293878974412429 14539925169898881927 

Second Run Output

14539925169898881927 14205293878974412429 

result:

ok correct

Test #5:

score: 100
Accepted
time: 1ms
memory: 3432kb

First Run Input

1 2
6710336009326057226 6575759325380514973

First Run Output

6575759325380514973 6710336009326057226

Second Run Input

2 0 6575759325380514973 6710336009326057226

Second Run Output

6710336009326057226 6575759325380514973 

result:

ok correct

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 3472kb

First Run Input

1 100
164 209 59 177 234 45 59 9 241 79 200 49 60 225 85 191 170 29 89 1 182 29 186 16 161 0 12 52 3 190 1 3 21 147 25 71 6 216 211 48 78 49 42 240 240 42 9 253 186 247 21 164 202 196 11 54 172 253 30 144 197 213 102 192 80 187 222 236 64 47 28 8 182 193 252 60 193 45 62 86 158 192 86 39 215 236 98 ...

First Run Output

53 151

Second Run Input

2 100 53 151
142 56 197 213 127 238 12 56 166 234 170 101 134 209 171 200 39 101 218 227 113 181 47 227 78 25 207 100 216 100 147 151 181 207 177 241 77 158 238 115 57 53 43 8 218 136 172 48 11 247 139 144 115 85 139 252 179 89 120 246 116 163 215 64 166 191 57 127 71 225 79 196 27 54 211 142 128 19...

Second Run Output

102 28 6 65 251 190 211 27 191 215 222 163 187 128 30 89 85 144 247 11 8 209 170 202 25 147 225 48 213 200 54 172 113 79 197 16 75 252 47 71 12 137 196 78 98 39 216 158 0 177 64 241 116 234 

result:

wrong answer incorrect, read 28 102 but expected 116 128