# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1055420 | YassirSalama | Financial Report (JOI21_financial) | C++17 | 99 ms | 29008 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
const int maxn=3e5+100;
vector<int> v[maxn];
int depth[maxn];
void dfs(int node,int par){
depth[node]=depth[par]+1;
for(auto x:v[node]){
dfs(x,node);
}
}
signed main(){
int n,d;
cin>>n>>d;
stack<pair<int,int>> st;
int nge[n];for(int i=0;i<n;i++) nge[i]=n;
for(int i=0;i<n;i++){
int x;
cin>>x;
while(!st.empty()&&st.top().F<x){
nge[st.top().S]=i;
st.pop();
}
st.push({x,i});
}
for(int i=0;i<n;i++){
v[nge[i]].push_back(i);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |