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

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

I made my own script to filter problems in CF problemset. If such script with same function already exists you can ignore my post or downvote it.

This is a python 3 script that fetches all problems from CF problemset and allows custom filtering. It supports custom filter criteria in python expression format. After you input the filter function, it filters the problems and choose a random one. More details can be found in spoilers below.

Filter Expression
Code

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

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

Автор Mindeveloped, история, 2 месяца назад, По-английски

I can use segment trees well, and I've done some basic scanline problems. But whenever these two algorithms appear in the same problem I will 100% fail to solve that one. I've been solving 930D - Игра с фишками and I was able to reduce it to "count the amount of integer points with at least one black point in each quadrant in terms of $$$(x+y, x-y)$$$". Then I stuck on the next move for 40 minutes. It turned out to be a stupid "scanline on $$$(x+y)$$$ build segment tree on $$$(x-y)$$$" thingy. Now I'm mad.

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

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

Автор Mindeveloped, история, 2 месяца назад, По-английски

Sorry for asking this 69 IQ question for yet another time, but I really have no idea what situation I'm in.

I started solving CF problems in a fixed difficulty range every day recently. From what I've heard, as a thumb rule you should solve X+200 (where X is your rating) difficulty problem, so I tried to solve problems rated from 2300 to 2400.

After solving a few problems, I discovered that I could solve about 90% of the problems I open. And it only costs me around 20 minutes to come up with an idea. So I think they might be too easy for me.

However, I feel that I'm usually still able to learn some new idea after I solved each problem. I enjoyed maths and construction problems more than I ever did before. Also, it's really tough for me to try 2500-2600 problems, as I can only solve 20% of them. I guess these are signs that their difficulty is probably OK.

So can anyone describe what situation I'm in and give me some help?

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

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

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

This idea has came out lots of times but still sadly no changes has been made. So I'm confused and decided to make a blog about it.

Upvote (or downvote I don't care) if you support this. If you have any different ideas you can also comment in comments section.

But some cheaters might realize their wrongdoing and be willing to change
But they will just make new accounts
But there will be false positives

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

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

Автор Mindeveloped, история, 10 месяцев назад, По-английски

Hello, everyone. I'd like to share an issue I met recently of which passing an STL container as a parameter through a function call caused MLE.

Look at this submission: 244198211. I was debugging it when I realized such line is causing MLE.

void insert (int p, string str, int len, int i, int id) {

I thought passing a string as a parameter might be the problem, so I changed my code and passed the index instead, and it got AC (there are other bugs but they don't matter): 244220216

So why is the problem?

The problem is, passing a parameter in non-reference calls the copy constructor and the destructor of the object each once, which means the object is being copied once every function call until it's finished. In normal situations it doesn't seems to be a big problem, but when you try to pass the object multiple times (especially if you're calling the function recursively) the memory usage is getting stacked up.

Note that this situation is the most common that people prefer to pass STL containers, especially string and vector in function parameters.

To make it clear I did some experiment, shown below:

#include<iostream>
using namespace std;

struct node {
	node () {
		cout << "Constructor called" << endl;
	}
	node (node &obj) {
		cout << "Copy constructor called" << endl;
	}
	~node () {
		cout << "Destructor called" << endl;
	}
};
node x;
void normal (node y) {
	cout << "Normal function body" << endl;
}
void reference (node &y) {
	cout << "Reference function body" << endl;
}
int main () {
	cout << "Calling normal function" << endl;
	normal (x);
	cout << "Finished calling normal function. Calling reference function" << endl;
	reference (x);
	cout << "Finished calling reference function" << endl;
	return 0;
}

And the result is:

Constructor called
Calling normal function
Copy constructor called
Normal function body
Destructor called
Finished calling normal function. Calling reference function
Reference function body
Finished calling reference function
Destructor called

From upon you can see that passing object as normal parameter calls copy constructor and destructor each once, and passing as reference does not do anything to the object.

So here are some suggestions to avoid this:

  1. Pass indices or pointers instead of the original object. The straightforward way, though it might makes the code look bad (imo).
  2. Use arrays instead of strings or vectors. Arrays are passed as pointers of the initial address (in other ways, they are passed as references automatically).
  3. Pass reference if you can. It makes the code more readable compared to 1.

EDIT: The idea was originally wrong, but thanks to the guy in comment I've corrected. The point is still valid, but the description needs a bit changing.

Thanks for reading.

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

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

Автор Mindeveloped, история, 13 месяцев назад, По-английски

I'm trying to improve by solving problems Codeforces, but I'm quite unsure about whether it really helps me improve or not. The question is, the problems I meet are either problems that I can solve in my first sight, or else problems I can't solve in an hour. How to fix this? I'm using the problem difficulty filter but it doesn't work because the actual difficulty for me still varies a lot even in a fixed difficulty number.

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

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

Автор Mindeveloped, история, 19 месяцев назад, По-английски

For example, if a successful hacking attempt on Div.2 is added to the system test data, will that case be added to Div.1 too?

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

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

Автор Mindeveloped, история, 20 месяцев назад, По-английски

Only ICPC scoring is available in virtual participation now. So please make Codeforces Scoring an option for virtual participation too.

Several advantages:

  1. It will be easier to see one's speed of doing a contest, as speed is far more effective in Codeforces scoring than ICPC.

  2. It will be even closer to a real contest.

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

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

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

When I participate Div.2 contests, I always solve the easy problems(such as A, B or C) quickly, but then I can't even move on other problems. What should I do in that case?

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

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