#include<iostream>
using namespace std;
int n, m, ds, a[1000001], l[1000001], r[1000001];
int main() {
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
a[i] = i;
l[i] = i - 1;
r[i] = i + 1;
}
for (int i = 1; i <= m; i++) {
cin >> ds;
if (l[ds] == 0)
cout << "* " << r[ds] << endl;
else if (r[ds] == n + 1)
cout << l[ds] << " *" << endl;
else
cout << l[ds] << " " << r[ds] << endl;
l[r[ds]] = l[ds];
r[l[ds]] = r[ds];
}
return 0;
}
06-10
3059
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-27
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交