0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-05 02:26:26 +00:00
OI-codes/S2OJ/1448/1448.cpp

32 lines
428 B
C++
Raw Normal View History

#include <iostream>
#include <set>
using std::cin;
using std::cout;
const char endl = '\n';
int n, m;
std::set<int> set;
int main() {
cin >> n >> m;
set.insert(0);
set.insert(n);
while (m--) {
int k;
cin >> k;
set.insert(k);
int prev = *--set.lower_bound(k),
next = *set.upper_bound(k);
cout << (k - prev) * (next - k) << endl;
}
return 0;
}