QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#344305 | #8254. Water Journal | Haidy_Yasser# | AC ✓ | 0ms | 3732kb | C++14 | 1.3kb | 2024-03-03 23:50:59 | 2024-03-03 23:51:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(x) int(x.size())
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
#define cin(v) for (auto& cn : v) cin >> cn;
#define cout(v) for (auto &cn : v) cout << cn << " ";
#define MOD int(1e9+7)
// #define endl "\n"
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
void Haidy()
{
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifndef ONLINE_JUDGE
//freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#endif
}
void solve();
int main()
{
Haidy();
int t = 1;
// cin >> t;
for(int i = 1;i<=t; i++)
{
solve();
}
return 0;
}
// int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
// int dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
struct team{
int id, school;
};
void solve()
{
int n, minn, maxx;
cin >> n >> minn >> maxx;
bool mini = false, maxi = false;
for(int i = 0; i < n-1; i++){
int x;
cin >> x;
mini |= (x == minn);
maxi |= (x == maxx);
}
if(!mini && !maxi)
cout << -1;
else if(!mini)
cout << minn;
else if(!maxi)
cout << maxx;
else{
for(int i = minn; i <= maxx;i++)
cout << i << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3724kb
input:
5 1 5 2 2 4 4
output:
-1
result:
ok single line: '-1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3656kb
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: 3688kb
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: 3600kb
input:
5 1 5 3 4 2 1
output:
5
result:
ok single line: '5'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3664kb
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: 3616kb
input:
2 1 50 24
output:
-1
result:
ok single line: '-1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2 2 49 49
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
2 2 49 2
output:
49
result:
ok single line: '49'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
6 1 45 10 15 20 25 40
output:
-1
result:
ok single line: '-1'