Блог пользователя LogitechSellout

Автор LogitechSellout, история, 4 года назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

Автор LogitechSellout, история, 5 лет назад, По-английски

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++.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор LogitechSellout, история, 6 лет назад, По-английски

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

Problem Statement: https://mirror.codeforces.com/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://mirror.codeforces.com/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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится