Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

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

I'm preparing for upcoming GCJ Finals. This year GCJ supports only Linux, and I want to learn how to compile solutions on Linux (I think I used it 9 years ago in IOI but completely forgot how to do that...).

Suppose that A.cpp, Main.java, A.py are source codes, A.in is the input, and you want to output to A.out.

On Windows+Cygwin, I usually do the following:

  • g++ -Wl,--stack,268435456 A.cpp -O2
  • ./a < A.in | tee A.out
  • javac Main.java
  • java Main < A.in | tee A.out
  • python A.py

What commands do the same things on Linux?

The following things are installed on the machine:

  • Debian Linux 9.4
  • C++ 6.3.0
  • Java 7 2.2.5
  • Python 2 2.7.13
Теги gcj, dcj
  • Проголосовать: нравится
  • +52
  • Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +49 Проголосовать: не нравится

For C++, to obtain the same outcome:

ulimit -s 268435456
g++ A.cpp -O2 -o A
./A < A.in | tee A.out

It may be possible to restrict stack size per app, but I couldn't find how. I'm suggesting ulimit, it sets stack size per bash session, I hope it's similar enough. I believe the other commands will be exactly the same as your Cygwin ones.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Does g++ on Cygwin compile + run?

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Instead of ./a < A.in | tee A.out you can simply write ./a < A.in > A.out

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

So actual software they have, I must say.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +204 Проголосовать: не нравится

rm -rf *

»
8 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I do not see any people mentioning the --std=c++11 or --std=c++0x or similar flags. You need these for range-based for loops, which some of us like to use. :)