QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#343264 | #8254. Water Journal | MayaZayn# | AC ✓ | 1ms | 3700kb | C++14 | 1.2kb | 2024-03-02 12:37:08 | 2024-03-02 12:37:09 |
Judging History
answer
#include <bits/stdc++.h>
#define MayaZayn ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define all_r(x) (x).rbegin(), (x).rend()
#define mnEl(vec) *min_element(vec.begin(), vec.end())
#define mxEl(vec) *max_element(vec.begin(), vec.end())
#define yes cout << "YES"
#define no cout << "NO"
#define in(v) for (auto & x : v) cin >> x
#define out(v) for (auto & x : v) cout << x << ' '
#define inLL(v) for (ll & x : v) cin >> x
#define openIn(x) freopen(x, "r", stdin);
#define openOut(x) freopen(x, "w", stdout);
#define M 1000000007
#define N 100005
using namespace std;
void solve() {
int n, a, b;
cin >> n >> a >> b;
bool mn = false, mx = false;
for (int i = 0; i < n - 1; ++i) {
int x;
cin >> x;
if (x == a)
mn = true;
if (x == b)
mx = true;
}
if (!mn && !mx)
cout << -1;
else if (!mn)
cout << a;
else if (!mx)
cout << b;
else
for (int i = a; i <= b; ++i)
cout << i << endl;
}
int main() {
MayaZayn
// int t;
// cin >> t;
// while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
input:
5 1 5 2 2 4 4
output:
-1
result:
ok single line: '-1'
Test #2:
score: 0
Accepted
time: 1ms
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: 3696kb
input:
5 1 5 1 2 3 4
output:
5
result:
ok single line: '5'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 1 5 2 4 5 1
output:
1 2 3 4 5
result:
ok 5 lines
Test #5:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
5 1 5 3 4 2 1
output:
5
result:
ok single line: '5'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3608kb
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: 3656kb
input:
2 1 50 24
output:
-1
result:
ok single line: '-1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
2 2 49 49
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 2 49 2
output:
49
result:
ok single line: '49'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
6 1 45 10 15 20 25 40
output:
-1
result:
ok single line: '-1'