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

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

Take a look at the end of these two programs:

https://atcoder.jp/contests/abc188/submissions/19361247

https://atcoder.jp/contests/abc188/submissions/19361394

One is correct and the other is not, even though in theory the one with std::min should be equivalent, since the first values of the arrays are all pairwise distinct.

EDIT: std::array variable holding fundamental types of local scope is not zero initialized (unlike other containers to my knowledge).

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

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

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

If I run a recursive (Java) program on my machine, stack overflow usually occures before reaching depth of 10000 (there is no tail recursion since Java does not make it available unfortunately). Yet on Codeforces my recursive programs on trees work up to 100000 or more (one such program I found is https://codeforces.net/contest/1406/submission/92624199). Does anyone have an idea why is it like this and how can I make it so this would also work on my machine or on other less advanced online judges?

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

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

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

To the more experienced contestants, do you have any tips on how should you approach the IOI to get a bronze medal? I know learning new things beforehand is more important, but do you have any tips beside that?

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

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

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

I was wondering now for sometime why my graph solutions usually take much more memory than fairly similar solutions in java. The thing is, I have avoided arrays of arraylist since arrays cant be assigned generics (if you use (ArrayList) array, some sites dont even accept your solution, but I have only know found out that you can just leave it without assigning this and it works just fine), but I have now finally tried using this, look at the result of two almost identical programs, only one has list of lists while the other has array of lists: (list of lists)-https://codeforces.net/contest/1324/submission/78422102 (array of lists)-https://codeforces.net/contest/1324/submission/78422518. Anyone knows why is this the case?

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

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

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

I solved this problem: https://codeforces.net/contest/1328/problem/E with the following program: https://codeforces.net/contest/1328/submission/78374395. The time it takes is ok, but it takes up quite a lot of memory (180 mb), but that doesn't make sense in my opinion since the program stores at most about 15 million integers.

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

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

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

In Java int was a number with a maximum of 2^32 while in C++ the guaranteed maximum of int is not necessarily more than 2^16. Should I therefore always use long when I used int in Java? But, if I look at the code of other competitors, they mostly use int?

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

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

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

I want to learn C++ for competitive programming. I have a good grasp (for competitive programmming needs) of Java. Where do you recommend learning it? Which editors do you use (I used Intellj Idea for Java)?

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

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

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

Here is my whole program: https://pastebin.com/dqqGn0rn. Here is the part of the program where the overflow happens: https://pastebin.com/JCCj8knQ. I get this error on a test with a million nodes: https://pastebin.com/eCxBK4pf. Is perhaps the language is use (Java) the problem? Can I fix this without making it iteratively and without changing my language?

EDIT: also, for the test on which it failes it says: time: 763 ms., memory: 252648 KB EDIT2: link to the problem: https://codeforces.net/contest/1335/problem/F

EDIT3: I put all the parametres from the recursive methods that I could into the object variables instead, I was sure that would help but I still get the overflow...

EDIT4: idk why am I getting all those downvotes... Is it cause I use Java? lol

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

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