idk321's blog

By idk321, history, 4 years ago, In English

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

Full text and comments »

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

By idk321, history, 4 years ago, In English

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?

Full text and comments »

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

By idk321, history, 4 years ago, In English

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?

Full text and comments »

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

By idk321, history, 5 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By idk321, history, 5 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By idk321, history, 5 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By idk321, history, 5 years ago, In English

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)?

Full text and comments »

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

By idk321, history, 5 years ago, In English

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

Full text and comments »

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