LogitechSellout's blog

By LogitechSellout, history, 4 years ago, In English

This was inspired by http://www.usaco.org/index.php?page=viewproblem2&cpid=842

The problem statement is: Given an array $$$a$$$, you are given two types of queries. The first type asks you to query for a single element $$$a[i]$$$, The second type is of update type $$$(l,r,val)$$$, where all $$$a[i]$$$ such that $$$l<=i<=r$$$ are unchanged if $$$a[i]<=val$$$, and reduced to $$$val$$$ if $$$a[i]>val$$$. You can imagine that the array a is a head of hair with hair lengths $$$a[i]$$$ at position $$$i$$$, and you want to cut some given intervals to a given length

This can be easily solved offline — just sort the update queries in decreasing $$$val$$$ and it's a textbook segment tree problem (you can do this in the usaco). But how do you solve it online?

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By LogitechSellout, history, 6 years ago, In English

Problem Statement: http://www.usaco.org/index.php?page=viewproblem2&cpid=741 Program: https://pastebin.com/mFpMZJYx

For some reason I've been getting this error every time I try to run this program, I can always build it, but every time I try to run/debug it says some variation of "Create Process error 193: %1 is not a valid Win32 application". This happens with no other project and its very confusing to me why it only happens with this. I can't check if the code even works correctly since I can't run it.

Things I've tried: — Reinstalling MinGW — Making sure my project directory contains no spaces (stackoverflow recommended this) — Testing on multiple IDEs such as clion, code blocks, emacs

I suspect that something might be wrong with the code but im very new to c++.

Full text and comments »

By LogitechSellout, history, 6 years ago, In English

Hi, I'm pretty new to CF and this is one of my first problems here

Problem Statement: https://codeforces.net/problemset/problem/245/H Basically you want to answer q queries, each stating the number of palidromes between two indicies of a long string

My code: https://codeforces.net/contest/245/submission/53304310

For some reason CF seems to time out, even though time complexity is alright (O(s^2+q)) which is quite odd

Could this because of my programming language? I know that java tends to be slow in these contests

Full text and comments »