ajit's blog

By ajit, history, 3 months ago, In English

Hi,

While solving problem H of the recent Codeforces Div3 round (link), I came across the following issue (after hours of debugging):

In my solution, I had to clear up the segment tree after every test case, so I kept track of all the elements I interacted with in an STL container. The issue is that if I use std::set for keeping track of changed elements in the segment tree, I have no issues, but if I use std::vector, I get a weird runtime error on test 4. Here are my two solutions:

  • Accepted solution (using std::set variable called changed_elements in segtree structure) link
  • Runtime error solution (using std::vector variable called changed_elements in segtree structure) link

Can anyone tell me what's causing this runtime error?

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it

By ajit, history, 4 years ago, In English

We hope that you have enjoyed this round! Here is the sketch of solutions for the problems.

A. Array and Peaks

  • Problem Setter: ajit
  • Editorialist: ajit
Tutorial
Implementation in C++

B. AND Sequences

  • Problem Setter: ajit
  • Editorialist: ajit
Tutorial
Implementation in C++

C. Add One

Tutorial
Implementation in C++

D. GCD and MST

  • Problem Setter: ajit
  • Editorialist: ajit
Tutorial
Implementation in C++

E. Cost Equilibrium

Tutorial
Implementation in C++

F. Swapping Problem

Tutorial
Implementation1 in C++
Implementation2 in C++

Full text and comments »

  • Vote: I like it
  • +153
  • Vote: I do not like it

By ajit, history, 5 years ago, In English

Why does this happen frequently nowadays?

Full text and comments »

  • Vote: I like it
  • +42
  • Vote: I do not like it

By ajit, history, 5 years ago, In English

In the recent codeforces global round 6 for the problem C DIVERSE MATRIX my code prints the transpose of the correct output matrix for the cases where r=1,c>1 and for r>1,c=1. But it gives me OK verdict for this wrong output format. This is my link to the submission.Is this a problem with the checker?

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it