We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Data Structures
- Advanced
- Swaps and Sum
- Discussions
Swaps and Sum
Swaps and Sum
Sort by
recency
|
6 Discussions
|
Please Login in order to post a comment
Am I completely mistaken, but will not a cartesian tree based on the indices always form a linked list? Left node will always be empty???
include
include
using namespace std;
int main() { int n=0,m=0; int t=0,l=0,r=0,x=0,sum=0; cin>>n>>m; int arr[n];
}
question is not clear
c++
undef NDEBUG
ifdef ssu1
define _GLIBCXX_DEBUG
endif
include
include
include
include
include
include
include
include
include
include
include
include
include
include
include
include
include
include
using namespace std;
struct node{ int cnt, pr, info; long long sum; bool rev; node *l, *r, *par; node(){ cnt = 1; pr = info = 0; sum = 0; rev = false; l = r = par = 0; } };
typedef node* tree;
const int MAX_BUF = 2e6; int szbuf; node buf[MAX_BUF];
struct explicit_treap{
};
void tswap(explicit_treap& t1, int l1, int r1, explicit_treap& t2, int l2, int r2){ tree p1, p2, p3, q1, q2, q3;
}
int main() {
ifdef ssu1
endif
ifdef ssu1
endif
}
The explanation in the editorial doesn't clarify that much why this solution is better. It would be nice if you explain what a cartesian tree is, for the ones don't know about. I know, just need to google it and find it, but again, would be nice that the participants could find all the information they need to be better programmers in the site. Besides that, code is clean, but some comments would help to understand the code to less expert developers.