CodeKnights.org ?>

CodeKnights.org

Assalamualaikum and good morning guys,

Next Saturday is CodeKnights Round 19. Which mean, very soon, I will not have enough finger on my hands and feet to count the number of rounds we had. When you think about it, its been more than 9 months since we started CodeKnights! How time flies. Because of this, we are now making a new website specially for CodeKnights.

CodeKnights new domain:

https://codeknights.org

So check it out. Its a bit plain for now, but new things will starts to pop up soon. We are still going to use our old contest system. Those things are too complex to be built in a short time. However, for registration, we are no longer using the old google forms. And that also means that the old registration is no longer valid. Which means you will need to re-register again using the new website. If you don’t register, you can’t participate on the next round. The good thing is, you can now change your username or password whenever you like.

The creation of the new website is to help us manage and improve CodeKnights. When you have this much rounds, certain things are getting quite unwieldy. Getting the rankings from previous round can be a chore or even impossible. Some people registered twice (or even thrice?) to change their username and password. Some people specified their university name using acronym, some do not, some uses acronym with small letter. Sometimes we forgot to announce a round and sometimes we don’t remember which round is it. We have about 145 registrations (not counting the previous DSA students), but not even a quarter of that is participating. Even, the question “when was round 15?” is a hard question to answer.

In fact, I’m sure you guys have your fair share of criticism. And it would be very helpful if you could voice it out in the comment sections below. We take all feedback constructively.

So that’s all folks! Thank you for reading. Good bye and Assalamualaikum.

Code Knights Round 14 Result and Problem Analysis ?>

Code Knights Round 14 Result and Problem Analysis

Assalamualaikum everyone. Its been awhile since I did a written analysis instead of a video or straight up, not doing it at all. Although recording a video is much more convenient that writing a blog, nothing beats creating a well authored blog post. That, and also the fact I did not finish this round, resulted in this post, albeit, late, because it takes time to type down these things.

Anyway, Round 14 is the second round after the last round which IIUM’s DSA student is scored for participation. Additionally, its kinda exam period for IIUM student… so… we are seeing a much lower participation, even after including participant from Hebron University, Palestine. In fact, looking at the ranking list, 6 out of 10 participant actually came from Hebron! If they did not participate, we would be looking at only 4 participant!

7b3cefd1-3daa-415e-8850-4cf98524ec77

Read More Read More

Code Knights Round 10 Results and Problem Analysis ?>

Code Knights Round 10 Results and Problem Analysis

Problem A’s Solution by Amjad:

#include <iostream>
using namespace std;
int n ;
int tmp;
int tallest = 1 ; 
int shortest = (1<<31)-1;
int main(){
    cin >> n ; 
    for(int i=0;i<n;i++){
        cin >> tmp;
        if ( tmp > tallest ) tallest = tmp;
        if ( tmp < shortest ) shortest = tmp;
    }
    cout << tallest << " " << shortest << endl;
    return 0;
}

Problem B’s Solution by Amjad:

#include <iostream>
#include <algorithm>
using namespace std;
int n ;
int a[1000001];
int main(){
    cin >> n ; 
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    cout << a[0];
    for(int i=1;i<n;i++){
        cout << " " << a[i];
    }
    cout << endl;
    return 0;
}

Problem C’s Solution by Asyraf:

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll,ll> pii;
#define REP(i,n) for(ll i=0;i<n;i++)

#ifdef DEBUG
#define dbg(x) x
#define dbgp(x) cerr << x << endl;
#else
#define dbg(x) //x
#define dbgp(x) //cerr << x << endl;
#endif

int main(){
    int n;
    cin >> n;
    set<int> graph[n];

    REP(i, n){
        int c;
        cin >> c;
        REP(j, c){
            int d;
            cin >> d;
            d--;
            graph[i].insert(d);
        }
    }

    int k;
    cin >> k;
    vector<int> instructions;
    REP(i, k){
        int d;
        cin >> d;
        d--;
        instructions.push_back(d);
    }

    bool valid = true;
    int cur = instructions[0];
    for(int i=1;i<instructions.size();i++){
        int next = instructions[i];
        if(graph[cur].find(next) == graph[cur].end() && next != cur){
            valid = false;
            break;
        }
        cur = next;
    }

    if(valid){
        cout << "Instruction is OK" << endl;
    }else{
        cout << "This instruction will lead you astray" << endl;
    }

}

Problem D’s Solution by Zarir:

#include <iostream>

using namespace std;

#define ll long long
#define MX 20

ll fact[MX+1];

int main(){
	fact[0]=1;
	for(int i=1;i<=MX;i++) fact[i] = fact[i-1]*i;
	int k,n,q;
	cin>>k>>n>>q;
	int pk;
	ll co;
	while(q--){
		co = fact[n];
		for(int i=0;i<k;i++){
			cin>>pk;
			co /= fact[pk];
		}
		cout<<co<<endl;
	}
	return 0;
}

Problem E’s Solution by Ayesha:

#include <bits/stdc++.h>
using namespace std;

int main(){
	int t, n = 12, input;
	int de[100], f[100];
	de[0] = 1;
	f[0] = 1;
	de[1] = 0;
	f[1] = 1;
	for(int i=2 ; i<=n; i++){
		de[i] = (i-1) * (de[i-1]+de[i-2]);
		f[i] = f[i-1]*i;
	}
	cin >> t;
	while(t--){
		cin >> input;
		cout << de[input] << "/" << f[input] << endl;
	}
	return 0;
} 
Code Knights Round 10 ?>

Code Knights Round 10

Assalamualaikum everyone,

This is an announcement for Code Knights Round 10. If this is the first time you heard of Code Knights, please checkout this link. The short version is that, we are organizing a competitive programming rounds every two weeks open to all Malaysian university student. We do this for practice, education and mostly for the fun of it.

The competition will be held online, similar with various other competitive programming platform such as codeforces and hackerearth, except the difficulty is tuned down to cater for beginner. You can use C, C++, Python or Java. There will be 5 problem to be solved with varying difficulty.

Date: 5th November 2016
Time: 8PM to 12 AM Malaysian Time
Venue: Online (Link will be given later)
Registration fees: * FREE *
Registration link for DSA students: https://goo.gl/forms/pecD8HUbhsSAta6B2
Registration link: http://goo.gl/forms/VJFvSmekoH2Uox203
Feedback form: https://goo.gl/forms/Mm1yGOM3dL8hWY0w1

If you want to participate in Code Knights, please fill up your details in the google forms link above. Register once, and you will be registered for all future rounds. We will remind you on the rounds through emails and whatsapp group. Please register before 6 pm on the day of the competition as I have to input your login information into the system. If you have any question, feel free to comment down below.

Code Knights Round 9 ?>

Code Knights Round 9

Assalamualaikum everyone,

This is an announcement for Code Knights Round 9. If this is the first time you heard of Code Knights, please checkout this link. The short version is that, we are organizing a competitive programming rounds every two weeks open to all Malaysian university student. We do this for practice, education and mostly for the fun of it.

The competition will be held online, similar with various other competitive programming platform such as codeforces and hackerearth, except the difficulty is tuned down to cater for beginner. You can use C, C++, Python or Java. There will be 5 problem to be solved with varying difficulty.

Date: 15th October 2016
Time: 8PM to 12 AM Malaysian Time
Venue: Online (Link will be given later)
Registration fees: * FREE *
Registration link for DSA students: https://goo.gl/forms/pecD8HUbhsSAta6B2
Registration link: http://goo.gl/forms/VJFvSmekoH2Uox203
Feedback form: https://goo.gl/forms/Mm1yGOM3dL8hWY0w1

If you want to participate in Code Knights, please fill up your details in the google forms link above. Register once, and you will be registered for all future rounds. We will remind you on the rounds through emails and whatsapp group. Please register before 6 pm on the day of the competition as I have to input your login information into the system. If you have any question, feel free to comment down below.

Code Knights Round 8 ?>

Code Knights Round 8

Assalamualaikum everyone,

This is an announcement for Code Knights Round 8. If this is the first time you heard of Code Knights, please checkout this link. The short version is that, we are organizing a competitive programming rounds every two weeks open to all Malaysian university student. We do this for practice, education and mostly for the fun of it.

The competition will be held online, similar with various other competitive programming platform such as codeforces and hackerearth, except the difficulty is tuned down to cater for beginner. You can use C, C++, Python or Java. There will be 5 problem to be solved with varying difficulty.

Date: 24th September 2016
Time: 8PM to 12 AM Malaysian Time
Venue: Online (Link will be given later)
Registration fees: * FREE *
Registration link for DSA students: https://goo.gl/forms/pecD8HUbhsSAta6B2
Registration link: http://goo.gl/forms/VJFvSmekoH2Uox203
Feedback form: https://goo.gl/forms/Mm1yGOM3dL8hWY0w1

If you want to participate in Code Knights, please fill up your details in the google forms link above. Register once, and you will be registered for all future rounds. We will remind you on the rounds through emails and whatsapp group. Please register before 6 pm on the day of the competition as I have to input your login information into the system. If you have any question, feel free to comment down below.

Code Knights Round 6 Results and Problem Analysis ?>

Code Knights Round 6 Results and Problem Analysis

Assalamualaikum everyone,

Last Saturday, the 6th round of Code Knights was held, with a total of….. 17 participants. Same as last round, which is also the same as the round before. This round is significantly harder than the last round, which was the easiest round by far.

Selection_094
It looks like only 12 participant, but actually there are 5 more down below which tried, but did not manage to solve any problems…

How hard? Well.. if you compare it to Round 3, its.. OK-lah. The winner for this round goes to anas_95 from IIUM, who also won last round. anas_95 was the only participant who manage to solve 4 problems, but he did not solve problem D. It’s nice to see someone from IIUM winning again, but its starting to get boring. Can someone else win next time? stdLn maybe? Heck, I’m even waiting for lim2481284 to make a comeback.

Read More Read More

Code Knights Round 6 ?>

Code Knights Round 6

Assalamualaikum everyone,

This is an announcement for Code Knights Round 6. In previous round, 17 participant from 7 Malaysian university participated in this competitive programming competition. The winner goes to “anas_95” from IIUM. If this is the first time you heard of Code Knights, please checkout this link. The short version is that, we are organizing a competitive programming rounds every two weeks open to all Malaysian university student. We do this for practice, education and mostly for the fun of it.

The competition will be held online, similar with various other competitive programming platform such as codeforces and hackerearth, except the difficulty is tuned down to cater for beginner. You can use C, C++, Python or Java. There will be 5 problem to be solved with varying difficulty.

Date: 27th August 2016
Time: 8PM to 12 AM
Venue: Online (Link will be given later)
Registration fees: * FREE *
Registration link: http://goo.gl/forms/VJFvSmekoH2Uox203
Feedback form: https://goo.gl/forms/Mm1yGOM3dL8hWY0w1

If you want to participate in Code Knights, please fill up your details in the google forms link above. Register once, and you will be registered for all future rounds. We will remind you on the rounds through emails and whatsapp group. Please register before 6 pm on the day of the competition as I have to input your login information into the system. If you have any question, feel free to comment down below.

Code Knights Round 5 Results and Problem Analysis ?>

Code Knights Round 5 Results and Problem Analysis

Assalamualaikum everyone,

Last saturday, Code Knights Round 5 was held with a total of 17 participant… which is pretty much the same with round 4. The winner (finally…) goes to anas_95 from IIUM by the virtue of answering all problems faster with less penalty (which is 0). This round is (unfortunately) the easiest round ever with 6 participant answering all problems.

Selection_087

The second place goes to UncleWong from UM and the third place goes to joscmw95 from UTAR. foreveralone, winner of round 4 is at the fourth place. Notable mention includes two time winner lim2481284 from UNITEN which continues his effort of not even trying. You can find the dataset and pdf through the link below:

PDF

Dataset

Read More Read More

Code Knights Round 5 ?>

Code Knights Round 5

Assalamualaikum everyone,

This is an announcement for  Code Knights Round 5. In previous round,  17 participant from 7 Malaysian university participated in this competitive programming competition. The winner goes to “foreveralone” (its his username) from UM. If this is the first time you heard of Code Knights, please checkout this link. The short version is that, we are organizing a competitive programming rounds every two weeks open to all Malaysian university student. We do this for practice, education and mostly for the fun of it.

The competition will be held online, similar with various other competitive programming platform such as codeforces and hackerearth, except the difficulty is tuned down to cater for beginner. You can use C, C++, Python or Java. There will be 5 problem to be solved with varying difficulty.

Date: 13th August 2016
Time: 8PM to 12 AM
Venue: Online (Link will be given later)
Registration fees: * FREE *
Registration link: http://goo.gl/forms/VJFvSmekoH2Uox203

If you want to participate in Code Knights, please fill up your details in the google forms link above. Register once, and you will be registered for all future rounds. We will remind you on the rounds through emails and whatsapp group. Please register before 6 pm on the day of the competition as I have to input your login information into the system. If you have any question, feel free to comment down below.