Skip to content

Commit 0caf624

Browse files
committed
new
1 parent 83b241c commit 0caf624

1 file changed

Lines changed: 18 additions & 30 deletions

File tree

sol.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#include <bits/stdc++.h>
22

3-
#define sqr(x) (x) * (x)
4-
#define sz(x) (int)x.size()
5-
#define all(x) (x).begin(),(x).end()
6-
#define rall(x) (x).rbegin(),(x).rend()
7-
#define prec(x) fixed<<setprecision(x)
8-
#define testcase cout << "Case " << tc++ << ": "
9-
#define unsyncIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
3+
#define sqr(x) (x) * (x)
4+
#define sz(x) (int)x.size()
5+
#define all(x) (x).begin(), (x).end()
6+
#define rall(x) (x).rbegin(), (x).rend()
7+
#define prec(x) fixed << setprecision(x)
8+
#define testcase cout << "Case " << tc++ << ": "
9+
#define unsyncIO \
10+
ios::sync_with_stdio(false); \
11+
cin.tie(nullptr)
1012

1113
using namespace std;
1214

@@ -23,39 +25,25 @@ using minHeap = priority_queue<T, vector<T>, greater<T>>;
2325
#define debug(...)
2426
#endif
2527

26-
const ld PI = acos(-1.0);
28+
const ld PI = acos(-1.0l);
2729
const ll MOD = 1e9 + 7;
30+
const ll INF = 2e18;
2831
const ld EPS = 1e-9;
2932
const int N = 2e5 + 5;
3033
int tc = 1;
3134

32-
int n, a[N], Left[N], right[N];
33-
34-
void solve() {
35-
cin >> n;
36-
for (int i = 1; i <= n; i++) cin >> a[i];
37-
stack<int> leftStack, rightStack;
38-
39-
leftStack.push(0);
40-
for (int i = 1; i <= n; i ++) {
41-
while (!leftStack.empty() and a[leftStack.top()] >= a[i]) {
42-
leftStack.pop();
43-
}
44-
debug(leftStack);
45-
Left[i] = leftStack.top();
46-
leftStack.push(i);
47-
}
48-
for (int i = 1; i <= n; i++) {
49-
cout << Left[i] << ' ';
50-
}
35+
void solve()
36+
{
5137
}
5238

53-
int main() {
39+
int main()
40+
{
5441
unsyncIO;
5542

5643
int t = 1;
57-
cin >> t;
58-
while (t--) {
44+
// cin >> t;
45+
while (t--)
46+
{
5947
solve();
6048
}
6149
return 0;

0 commit comments

Comments
 (0)