PavelKunyavskiy's blog

By PavelKunyavskiy, 10 years ago, In English

Good time of the day.

As some of you know, yeputons and I have an archive of IOI-tasks. While preparing it, we had understood, that we have no resources to prepare graders for all languages,so we want to find a way to write a grader only for C, and to link other languages to it.. Also, I think it's better to have one grader and adapters to avoid code duplicating, which can cause errors.

There were some problems with linking Pascal, but they were mostly solved. I'll write about one unsolved problem further. It would be very good if someone have ideas how to solve it.

Next year Java will be available on IOI. So I tried to write Java adapter for graders. Here is one for the problem 2010.cluedo. I think this one works well.

I publish this because I think someone else can be interested in it. Also I have some problems, which I don't know how to solve. Probably someone here can solve them.

First of all, we need to include jni.h. But it doesn't belong to gcc library path. So we need to set path, which depends on computer settings (path to java, to be more precise).
Also this way is quite complicated to compile. I don't know how to do this in some IDE, which is probably used by participant using java. And participant probably don't know what is jni, and how to do something like this.
The same problem happens to pascal. Also there is one extra problem. FPC needs libc to link this. And I don't know way to find libc on windows. libmsvcrt.a from MinGW is ok. But how to find it on participants computer? And what to do, if he is using some other compiler? Also, participant needs C-compiler to use Pascal, and that is not very good.

All this problems are not really important on competition (as we know settings of participants computers), but if we use on-line judge for it we will face the above-mentioned problems.

I hope there is someone from ISC or some other IOI structures, who can help with it, who is reading Codeforces. Anyway, if you have some ideas how to make this better, or any comments, I will be very interested in it.

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

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think that the CMS developers could be interested in this. You should post this on the mailing list :)

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Wow, I didn't think this was possible... I assume that at the bottom level, this is just an added layer of function calls with almost no performance overhead?

For the extra files, would it be possible to just include them in the packages that the users download? Are these files also system-dependent?

Another possibility of setting up these tasks is to simply specify the I/O format used by the grader and turn the task back into a batch task. Are you removing the I/O runtimes in the grader? Are there other reasons for keeping them in the interactive judge format?

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    For pascal, there is no overhead. I didn't realy test for java. I'll test it for 2006.blackbox (I don't find way to make it, except graders. about 15000000 I/O interactions is too slow).

    libc is system dependent. It's library, wich contains functions like print/scanf/exit and etc. Olso it probably can be compiler-dependent (i din't tryed anything except gcc). For java, headers are system-dependent to. They are included in jdk. So they can be found using somethink like (dirname "(dirname "(readlink -f "(which javac)")")") (there should be more $, but CF can't parce them), but this is a bit strange way.

    I have no idea how to remove grader runtime. I think they should be in interactive format, because it's preparation for IOI, so it should be like IOI.

»
10 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Hi Pavel,

I'm a developer of CMS, the contest system used in the last few IOIs. We have a few examples of graders in several languages, Java and Pascal among them. There are two trees containing examples: - https://github.com/cms-dev/con_test contains an example task for each task type in the format of the Italian repository (that is independent from the structure of the graders); you can see graders in /sol/grader.*. - https://github.com/cms-dev/cms/tree/master/cmstestsuite/tasks is the root of our functional test suite, with some other example of tasks — the format is a bit weird, you can find graders in /code/grader.*.

Note that at the moment the support for Java is given by compiling with gcj to an executable. This isn't necessarily what will be used in IOI 2015, but if I had a vote it would be for this solution, being the most straightforward one.

About having a shared and public repo of IOI problems, it would be really cool!

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    I would really recomend against gcj. It is rather incomplete and outdated Java implementation. It is almost like using Turbo C for C++

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well, you show graders for Java solutions, written in Java. Probably, that is problem of same level as running any java solutions.

    I'm talking about writing one grader for all languages and adapters for each languages. This can avoid code duplicating and bugs, which it often produce.

    About having a shared and public repo of IOI problems, it would be really cool!

    We are working on publishing online judge with IOI 2003-2014 on contest.yandex.ru Probably it would be ready in several weeks.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Regarding GCJ, weren't GCC developers looking to drop Java support?

    Also, the latest news on the project page are back in 2009.

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Admittedly I don't know much about the status of gcj, but it gives the important advantage of homogeneity with the existing languages — this is not just because it does not require additional work on the system, but also because it is much easier to be fair in the way resources are constrained.

      • »
        »
        »
        »
        10 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        It may be very convinient, but it is really not an option. It would be fairier to provide no Java support at all then to provide it through gcj