QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343034#8254. Water JournalElTeeran_ElHayga#AC ✓0ms3700kbC++201.5kb2024-03-01 21:13:272024-03-01 21:13:28

Judging History

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

  • [2024-03-01 21:13:28]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3700kb
  • [2024-03-01 21:13:27]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define EPS 1e-9
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define yes cout << "YES" << '\n';
#define no cout << "NO" << '\n';
#define mem(arrr, xx) memset(arrr,xx,sizeof arrr)
#define endl '\n'
#define PI acos(-1)
#define Ones(n) __builtin_popcount(n)
#define Onesl(n) __builtin_popcountll(n)
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const ll MOD = 1e9 + 7;
const ll N = 100 + 5;
const int OO = 0x3f3f3f3f;
const ll LOO = 0x3f3f3f3f3f3f3f3f;
int dx8[] = {+0, +0, -1, +1, +1, +1, -1, -1};
int dy8[] = {-1, +1, +0, +0, +1, -1, +1, -1};
int dx4[] = {+0, +0, -1, +1};
int dy4[] = {-1, +1, +0, +0};

void Rokba() {
    cin.tie(nullptr), cout.tie(nullptr), cin.sync_with_stdio(false), cout.sync_with_stdio(false);
#ifdef Clion
    freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#endif
}

int freq[N];
void Solution() {
    int n, a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < n - 1; ++i) {
        int x;
        cin >> x;
        freq[x]++;
    }
    if(!freq[a] && !freq[b]){
        cout << -1 << '\n';
        return;
    }
    if(!freq[a]){
        cout << a << '\n';
        return;
    }
    if(!freq[b]){
        cout << b << '\n';
        return;
    }
    for (int i = a; i <= b; ++i) {
        cout << i << '\n';
    }
}

int main() {
    Rokba();
    int T = 1;
//    cin >> T;
    while (T--) {
        Solution();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 1 5
2
2
4
4

output:

-1

result:

ok single line: '-1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

5 1 5
1
2
4
5

output:

1
2
3
4
5

result:

ok 5 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

5 1 5
1
2
3
4

output:

5

result:

ok single line: '5'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

5 1 5
2
4
5
1

output:

1
2
3
4
5

result:

ok 5 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

5 1 5
3
4
2
1

output:

5

result:

ok single line: '5'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

8 12 12
12
12
12
12
12
12
12

output:

12

result:

ok single line: '12'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

2 1 50
24

output:

-1

result:

ok single line: '-1'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

2 2 49
49

output:

2

result:

ok single line: '2'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

2 2 49
2

output:

49

result:

ok single line: '49'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

6 1 45
10
15
20
25
40

output:

-1

result:

ok single line: '-1'