女王的大赦令 大模拟
作者:
徐枭翔
,
2024-08-03 16:22:46
,
所有人可见
,
阅读 2
https://pintia.cn/problem-sets/1556843855285559296/exam/problems/type/7?problemSetProblemId=1556843936151740417&page=0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PII;
typedef vector<long long> VI;
#define int long long
#define INF 0x3f3f3f3f
#define endl '\n'
#define N 200010
const int mod = 1e9 + 7;
ll lowbit(ll x) {
return -x & x;
}
int p[N], si[N];
int find(int x) {
if (x == p[x])return p[x];
p[x] = find(p[x]);
return p[x];
}
//size[find(b)] += size[find(a)];
//p[find(a)] = find(b);
//bool cmp(pair<int, int> a, pair<int, int> b){
// return a.f
//}
void solve() {
int n;
cin >> n;
vector<pair<int, int>> time;
int a[1010];
a[n + 1] = 1e9;
for (int i = 1; i <= n; i ++)cin >> a[i];
int red = 0, l = 0, r = 0, add = 0;
for (int i = 1; i <= n + 1; i++) {
if (!red) {
red = 1;
l = a[i] + 15;
r = l + 29;
}
else {
if (a[i] < l)continue;
if (a[i] > r) {
add = 0, red = 0;
// time.push_back({l, r});
cout << l << " " << r << endl;
i --;
continue ;
}
if (!add) {
add = 1;
r += 15;
}
}
}
//
// if (r)time.push_back({l, r});
//
// for (auto [l, r] : time) {
// cout << l << " " << r << endl;
// }
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while (T --)
solve();
return 0;
}