Computer Science Canada

Question about CCC

Author:  Annology [ Tue Sep 20, 2011 11:29 pm ]
Post subject:  Question about CCC

Hi,
I was wondering that since Stage 1 of CCC is marked in school, is it necessary for the teacher at my school to know the language I'm using? Also, since books and written material are allowed, are we also allowed to bring in notes we made ourselves?
I'm new to the game here, hoping to write ccc this year xD

Author:  Tony [ Wed Sep 21, 2011 12:06 am ]
Post subject:  RE:Question about CCC

I believe that the teacher only marks for the execution (right result in a reasonable amount of time), not the quality of code. They just need to be able to run it. There might be sanity checks by Waterloo, should a student qualify for Stage 2.

I don't remember about the allowed material, and http://cemc.math.uwaterloo.ca/contests/computing/details.html doesn't say. Maybe someone else remembers?

If you want to practice for the contest, there's http://dwite.org/ We'll be posting the schedule in the next few days; there are monthly rounds in a format similar to CCC, but you submit solutions online and we get a computer to grade it right away Wink

Author:  mirhagk [ Wed Sep 21, 2011 8:41 am ]
Post subject:  RE:Question about CCC

The teacher has to quickly check the code to make sure it isn't:
code:

cout<<"Answer1\nAnswer2\nAnswer3";

And tony, dwite should have a system similar to google code jam, where you upload the output file after downloading the input file.

That way people can write it in any language they want, and if you put a time limit on how long you have after downloading an input until uploading the output, like the google code jam does, it still requires the program to run within a certain time frame.

Author:  Tony [ Wed Sep 21, 2011 1:36 pm ]
Post subject:  RE:Question about CCC

DWITE aims to match CCC's questions and style, not Code Jam.

Author:  crossley7 [ Wed Sep 21, 2011 8:15 pm ]
Post subject:  RE:Question about CCC

Sweet, can't wait for Dwite this year. Just hope that the Dwite servers don't crash or get hacked this year. See if we can win a round this year or at least get top 5.

Author:  A.J [ Wed Sep 21, 2011 10:06 pm ]
Post subject:  RE:Question about CCC

Well, we send the teachers a pretty detailed explanation on how to mark the submissions. However, if you don't happen to have a CS teacher as such at your school, then merely get some other teacher to mark it with the help of a senior student (preferably someone who has written the CCC before). I thought Mr.Hughes was still around (I have yet to meet him, and it was been 4 years since we have contacted each other).

Author:  crossley7 [ Thu Sep 22, 2011 8:35 pm ]
Post subject:  RE:Question about CCC

Mr Hughes is still here, so i know we are fine... but it was my friend and I that ended up marking our CCC solutions last year (as I am the only one that has access to a c++ compiler on my laptop and a few people used it). I don't think the original poster is from Crossley though.

It would be awesome though AJ if you could contact him and maybe provide him with some dynamic and recursive type problems... those seem to be the biggest weak point at crossley Very Happy

Author:  A.J [ Fri Sep 23, 2011 1:44 pm ]
Post subject:  RE:Question about CCC

Haha, that was how I met Mr.Hughes in the first place. He emailed a friend of mine and I about 4 years ago asking for a few DP problems. I would suggest that you guys come to Waterloo for attending CS clubs here at WCI, but seeing as that's too far maybe we can set up some sort of regional CS club that meets up once a month or so.

Author:  crossley7 [ Fri Sep 23, 2011 8:26 pm ]
Post subject:  RE:Question about CCC

I would love to do that and think that at least a few of my friends would as well (the other guys that went to ECOO provincials last year)

If we did a monthly thing on weekends somewhere, I think we could easily come to Waterloo or somewhere near there or maybe rotate where we meet.

I will talk to them at school monday or before and see what their interest is but I think they would love to have a chance to grow in knowledge of those problems.

Author:  mirhagk [ Fri Oct 14, 2011 3:41 pm ]
Post subject:  RE:Question about CCC

@Tony I know that the Dwite is supposed to mimic the CCC, which is why I think that any programming language should be allowed. Obviously you can't copy CCC's style, because there aren't teachers to supervise, but the current dwite style is not like the CCC, and the google code jam model would be much more like the CCC, but it'd give the opportunity to use any programming language, which is what the CCC allows (minus symbolic languages). http://cemc.math.uwaterloo.ca/contests/computing/details.html.

I think if you looked at how the google code jam did it, you'd realize that's it's essentially the online version of CCC, and allows for all the things that the CCC allows for, without anything else really. The dwite is not the most accurate online version of the CCC, since it's very specific what you can and can't use.

Author:  Tony [ Fri Oct 14, 2011 4:23 pm ]
Post subject:  RE:Question about CCC

is there a particular language that you want to use for DWITE that is not currently supported?

Author:  mirhagk [ Fri Oct 14, 2011 6:22 pm ]
Post subject:  RE:Question about CCC

Well last time C# was only supported by someone compiling it manually, and I know a whole bunch of people who are going to compete this year with that language.

I don't know if that is/will be supported, but even if that specifically gets supported, there is still limitations. I mean do you really want to do all kinds of work every time a new popular language comes along?

Author:  Tony [ Fri Oct 14, 2011 6:57 pm ]
Post subject:  RE:Question about CCC

That hasn't been a problem yet. Besides, having only public test cases will make this very different from CCC, to a point of either being meaningless or unreasonably difficult.

Author:  mirhagk [ Fri Oct 14, 2011 7:02 pm ]
Post subject:  RE:Question about CCC

what? How does it make it different? The test cases are only available once the are downloaded, and you may only upload them within 5 minutes (or something similar). Yes of course someone could distribute their "solution" to others, but who's to say that theirs is right? (so long as you don't mark it instantly).

Also note that the google code jam requires people to upload their source code, so you could do the usual similarity check to see if anyone cheated, and a simple sanity check to make sure the code actually calculates something.

I'm open to criticism for the idea, but I don't see how it has any downsides that do not already exist within the current system.

Author:  Tony [ Fri Oct 14, 2011 7:17 pm ]
Post subject:  Re: RE:Question about CCC

mirhagk @ Fri Oct 14, 2011 7:02 pm wrote:
... requires people to upload their source code...

So we are back to having to compile it on server-side anyway. If there's no compilation, I can just pull a bunch of bits from /dev/random and it will be sufficiently different from every other upload.

Author:  mirhagk [ Fri Oct 14, 2011 7:20 pm ]
Post subject:  RE:Question about CCC

There's no compilation, however it does allow you to check manually to see if someone cheated or not, very easily.

Author:  Tony [ Fri Oct 14, 2011 7:24 pm ]
Post subject:  RE:Question about CCC

Checking every submission manually is _much_ more work than having to install some new language every once in a while.

Besides, there's no way for you to know if my random blurb of bits is garbage or a legitimate solution in some esoteric programming language that you don't recognize.

Author:  mirhagk [ Fri Oct 14, 2011 7:29 pm ]
Post subject:  RE:Question about CCC

Okay say there are 5 questions. And for each question there is 3 VERY similar data sets, to the point that they have the same tricks or w/e, but produce slightly different outputs. Then if someone cheats for all 5 questions, they have a 1/(3^5) chance of getting it right, which works out to about 0.4% of getting it correct. You can see how easily someone who cheats can be noticed. Then all you need to check is all the people who cheated (ie uploaded the WRONG output data, but that matches a different input data).

Chances are that someone won't get a problem wrong, and have it be right for one of the other 2 data sets, so you have a pretty good chance they are cheating already. If the code looks like it does something, then they can be cleared. Even if it's some strange esoteric language your unfamiliar with, you can request that they send a video of them compiling the problem themselves using that as the source, or you could try and do it.

Yes it will require some manual work, but only for those that cheat, and manage to cheat effectively enough to provide source code that isn't just gibberish, or is a esoteric language.

Author:  Tony [ Fri Oct 14, 2011 7:52 pm ]
Post subject:  Re: RE:Question about CCC

I would argue your every point, but
mirhagk @ Fri Oct 14, 2011 7:29 pm wrote:
you can request that they send a video of them compiling the problem themselves using that as the source, or you could try and do it.

I'm now convinced that you are just trolling.

No, them sending me their compiler and video is not "less work" than me installing that compiler myself ahead of time.

Author:  mirhagk [ Fri Oct 14, 2011 8:05 pm ]
Post subject:  RE:Question about CCC

This is considering the very worst most extreme case, where they are using a programming language you have never heard of, and it's so esoteric that's it's not even remotely readable.

I'm just saying that it's not really likely for someone to get away with cheating, the only way it's possible is for someone to send their source code to someone else, and they alter it, but that's already possible.

Author:  Tony [ Fri Oct 14, 2011 8:15 pm ]
Post subject:  RE:Question about CCC

Point is -- you fail to convince me that putting in effort into rewriting the system and retraining existing users will provider at least as much benefit over any timeline.

Author:  mirhagk [ Fri Oct 14, 2011 8:20 pm ]
Post subject:  RE:Question about CCC

Okay, well how much effort will it be to get the linux computer to properly run C# .NET programs? Because all of my school (at least 10 students) will be competing using C#, so I'm assuming you won't want to do it manually.

My point is that it's definitely a better system, and only requires work once, for every language, instead of new work for each language. So if adding new languages takes x1 amount of time, and converting the system takes x2 amount of time, what value of n would make n*x1>x2? If it's a low value, such as 1 to 4 it may be a better option, requiring less work.

Author:  A.J [ Fri Oct 14, 2011 8:24 pm ]
Post subject:  RE:Question about CCC

DWITE purpose isn't *solely* to train high school students for contests such as ECOO and CCC, but to also be its own unique experience. Also, regarding cheating, like most online contests we are kind of going by the honor system here. I mean I don't know why someone will cheat in a contest where don't really gain any prize (except for knowledge, which cheating doesn't help you gain).

Author:  Tony [ Fri Oct 14, 2011 8:24 pm ]
Post subject:  RE:Question about CCC

DWITE already supports C# http://dwite.org/judge Let me know if there's a different version of the compiler that you want to use.

Author:  mirhagk [ Fri Oct 14, 2011 9:19 pm ]
Post subject:  RE:Question about CCC

Alright well if it's not compatible with the compiler, who's fault is it? ie, if it doesn't run on the system because of different versions/libraries and what not, do I fail the question, or does it get marked manually?

For instance some code I just wrote for the purpose of testing algorithms and contest problems won't compile on the 2005 compiler (or the 2007 compiler) since it uses duck typing. Similarly C# 4.0 also uses optional parameters, and a couple other goodies.

And C# 3.0 uses features I use very commonly, for instance inline object and collection initializes, extension methods, and my personal favourite, lambda expressions (makes using sort functions SO much easier)

Author:  Tony [ Fri Oct 14, 2011 9:37 pm ]
Post subject:  RE:Question about CCC

If you choose to not follow instructions and choose to submit against a wrong compiler then... we give you an error message and another chance to do things right. If your code doesn't compile the second time as well, then yeah... you fail.

I mean sure, if your high school homework doesn't compile you could argue your way into some part marks. But I think it's a reasonable expectation to have you at least try to compile the code yourself before submitting it for grading. If it doesn't, no other contest will give you any marks just the same.

Author:  mirhagk [ Sat Oct 15, 2011 11:25 am ]
Post subject:  RE:Question about CCC

That's not true, the CCC, the ECOO, and the Google code jam don't care what compiler you use. The code is 100% valid C# code, it's just modern, and doesn't run on old compilers.

Basically C# is supported, but not modern C#, which is another good reason for the ECOO/Google code jam model, since it will allow people to use new features, and not have to revert to using older, less efficient methods.

I should make sure my code compiles and runs fine, I should not have to know the exact compiler you use, and make sure I have a copy of that, just to make sure that it works on your system.

Author:  Tony [ Sat Oct 15, 2011 1:28 pm ]
Post subject:  Re: RE:Question about CCC

mirhagk @ Sat Oct 15, 2011 11:25 am wrote:
That's not true, the CCC, the ECOO, and the Google code jam don't care what compiler you use.

What part was "that" referring to? The rest of that sentence did not seen directly relevant to anything I've said last. You are still wrong anyway. CCC (Stage 2) is _very_ restrictive http://www.cemc.uwaterloo.ca/contests/computing/details.html#languages
Quote:

For Stage 2, competitors must use Pascal and/or C/C++.

Stage 1 (and ECOO) does the same has some restrictions along the lines of "any programming language which is supported at their school". Lacking strict on-site supervision, the "which is supported" part is moved from school to DWITE.

mirhagk @ Sat Oct 15, 2011 11:25 am wrote:

I should not have to know the exact compiler you use, and make sure I have a copy of that, just to make sure that it works on your system.

You should know the exact compiler that your school supports. Similarly, you should know the exact compiler that DWITE supports.

Author:  mirhagk [ Sat Oct 15, 2011 2:02 pm ]
Post subject:  RE:Question about CCC

The "that" refers to the fact that you said we'd get no marks for code that is 100% valid, just isn't supported by your compiler.

And the HUGE difference between knowing which lanugage is supported at your school, and at dwite, is that you can change it to get the version you'd like.

Author:  Tony [ Sat Oct 15, 2011 2:10 pm ]
Post subject:  RE:Question about CCC

I've said
Tony @ Fri Oct 14, 2011 9:37 pm wrote:
But I think it's a reasonable expectation to have you at least try to compile the code yourself before submitting it for grading. If it doesn't, no other contest will give you any marks just the same.

If you submit code to CCC that does not compile, then you fail every test case and end up with a 0.

And just as you can ask your school to support a new language, you can ask me to extend the list of languages/versions on DWITE.

Author:  mirhagk [ Sat Oct 15, 2011 2:15 pm ]
Post subject:  RE:Question about CCC

But the code is marked by the teacher, then sent to the CCC, and since it's any language the school supports, as long as SOME compiler supports it, the CCC will be okay (for 1st round).

And if you are willing to support a new language, then I'd request for the newest C# to be supported.

I would have just asked, but I assumed there was a technical reason why it wasn't (considering the fact that it was unsupported last year, so support is recent). I didn't think that there was any reason to use a compiler from 2 versions ago, other than it not working (which is possible since it runs XP).

Author:  Tony [ Sat Oct 15, 2011 2:20 pm ]
Post subject:  RE:Question about CCC

Right. But if the school doesn't support the language, you fail just the same. Granted that you have some leeway to convince the school to support your tools after the contest is over, but before the marks are sent in. Since DWITE marks submissions much faster, that is obviously one of the (many) points where the contests differ.

I'll ping Dan about C#.

Author:  mirhagk [ Sat Oct 15, 2011 2:31 pm ]
Post subject:  RE:Question about CCC

Okay, but if you guys can't set up .NET 4.0 with C# 4.0, even when asked beforehand, I still gotta downgrade the school's compilers, and relearn the older language?

Author:  Tony [ Sat Oct 15, 2011 3:50 pm ]
Post subject:  RE:Question about CCC

Or learn a new different language Wink

But ultimately yes, you get to play within our limitations.

Author:  mirhagk [ Sat Oct 15, 2011 4:20 pm ]
Post subject:  RE:Question about CCC

I know many more languages, but I'm going to choose the language that lets me write code the fastest, and that is definitely C#.

Let me know if it can't be supported, because I probably won't be able to convince the school to get older compilers on several machines, just for a practice competition.

Author:  ultimatebuster [ Tue Nov 01, 2011 12:15 pm ]
Post subject:  RE:Question about CCC

Speaking of languages, I thought they added Java to stage 2 some time ago?

Also, for the senior contest, they're requesting a file as input, how are the input filenames laid out? just s1.txt s2.txt and do I have to get each of that? Or how do they do it?

Author:  d310 [ Tue Nov 01, 2011 5:18 pm ]
Post subject:  Re: Question about CCC

I don't believe so.
The purpose of CCC Stage 2 is to select students for the IOI.
Since IOI doesn't use Java then CCC Stage 2 won't allow Java.

Author:  Yves [ Tue Nov 01, 2011 5:30 pm ]
Post subject:  Re: RE:Question about CCC

ultimatebuster @ Tue Nov 01, 2011 12:15 pm wrote:
how are the input filenames laid out?

Input files are sn.in for problem n.
(e.g. s3.in for problem 3.)

Author:  ultimatebuster [ Sun Nov 06, 2011 4:29 pm ]
Post subject:  Re: RE:Question about CCC

Yves @ Tue Nov 01, 2011 5:30 pm wrote:
ultimatebuster @ Tue Nov 01, 2011 12:15 pm wrote:
how are the input filenames laid out?

Input files are sn.in for problem n.
(e.g. s3.in for problem 3.)


So do I have to write a reader that reads anything from s1 to s...
I don't even know how many inputs there are.

Author:  crossley7 [ Sun Nov 06, 2011 6:27 pm ]
Post subject:  RE:Question about CCC

Each question has it's own set of input and will tell you what test cases consist of and you just need to read in based on what it says like you do for reading from any text file.

The language should have its own read in from file type of command/library and you just use it for reading in.

In C++ it would be
#include <fstream>
and in the main function
ifstream input;
input.open ("file.in");
input >> (whatever you are reading in);

In turing it would be
var IN : int
open : IN, get
get : IN, (whatever you are reading in)

any other language you will have to ask around since I don't know how it works for those.

Author:  Tony [ Sun Nov 06, 2011 6:32 pm ]
Post subject:  RE:Question about CCC

Naturally one should be comfortable reading from a file, in the language of their choice. It would be kind of embarrassing to get stuck at the very first step and not be able to even attempt any of the questions.

It might be a good idea to participate in a couple of rounds of DWITE, just to get some practice in.

Author:  Yves [ Mon Nov 07, 2011 9:03 pm ]
Post subject:  Re: RE:Question about CCC

ultimatebuster @ Sun Nov 06, 2011 4:29 pm wrote:
Yves @ Tue Nov 01, 2011 5:30 pm wrote:
ultimatebuster @ Tue Nov 01, 2011 12:15 pm wrote:
how are the input filenames laid out?

Input files are sn.in for problem n.
(e.g. s3.in for problem 3.)


So do I have to write a reader that reads anything from s1 to s...
I don't even know how many inputs there are.


Sample code for CCC 1996 Stage 1 Problem A (analogous to S1):

code:

#include <cmath>
#include <cstdio>
int main() {
    using namespace std;
    freopen("s1.in", "r", stdin);
    int n; // s = sum of factors
    scanf("%d", &n);
    for (int l = 0; l < n; l++) {
        int a, s;
        scanf("%d", &a);
        s = -a;
        for (int i = 0; i < (int)ceil(sqrt(a)); i++)
            if (a % i == 0)
                if (i * i == a)
                    s += i;
                else
                    s += i + a / i;
        if (s < a)
            printf("%d is a deficient number.\n", a);
        else if (s > a)
            printf("%d is an abundant number.\n", a);
        else
            printf("%d is a perfect number.\n", a);
    }
    fclose(stdin);
    return 0;
}

Offtopic:
Alternatively:
code:

#include <cmath>
#include <cstdio>
int main() {
    freopen("s1.in", "r", stdin);
    int a, s, i, n; // s = sum of factors
    for (scanf("%d%d", &n, &a); n --> 0 && (s = -a); scanf("%d", &a)) {
        for (i = 1; i < (int)std::sqrt(a) + 1; i++)
            s += a % i ? 0 : i * i == a ? i : i + a / i; // if i | a, then add i and its complement (unless i = a^(1/2))
        printf("%d is a%s number.\n", a, s < a ? " deficient" : s > a ? "n abundant" : " perfect");
    }
    fclose(stdin);
    return 0;
}



: