QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746070#8254. Water Journalt-aswathAC ✓0ms3688kbC++141.4kb2024-11-14 13:15:142024-11-14 13:15:14

Judging History

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

  • [2024-11-14 13:15:14]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3688kb
  • [2024-11-14 13:15:14]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define deb(x...) 42
#endif

#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define MOD 1000000007

void solve() {
    ll n,a,b;
    cin>>n>>a>>b;
    bool mi=false,mx=false;
    for(ll i=0;i<=n;i++){
        ll x;
        cin>>x;
        if(x==a) mi=true;
        if(x==b) mx=true;
    }
    if(!mi && !mx){
        cout<<"-1\n";
        return;
    }
    if(mi && !mx){
        cout<<b<<endl;
        return;
    }
    if(!mi && mx){
        cout<<a<<endl;
        return;
    }   
    for(ll i=a;i<=b;i++){
        cout<<i<<"\n";
    }
}


int main() {
  fast_io;
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("output.txt", "w", stderr);
#endif
  ll t = 1;
  // cin >> t;
  for(ll i = 0; i < t; i++) {
#ifdef LOCAL
    cout << "CASE " << i + 1 << ":\n";
#endif
    solve();
  }
#ifdef LOCAL
  cout << endl << "Finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n\n";
#endif
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 1 5
2
2
4
4

output:

-1

result:

ok single line: '-1'

Test #2:

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

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: 3684kb

input:

5 1 5
1
2
3
4

output:

5

result:

ok single line: '5'

Test #4:

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

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: 3532kb

input:

5 1 5
3
4
2
1

output:

5

result:

ok single line: '5'

Test #6:

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

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: 3644kb

input:

2 1 50
24

output:

-1

result:

ok single line: '-1'

Test #8:

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

input:

2 2 49
49

output:

2

result:

ok single line: '2'

Test #9:

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

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'