Browsed by
Author: amjadm

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 7 Results and Problem Analysis ?>

Code Knights Round 7 Results and Problem Analysis

Assalamualaikum everyone,

Last Saturday, the 7th round of Code Knights was held, with a total of….. 12 participants. The problems of this round are prepared without proper care due to last minute changes in internal schedule (Eidul Adha specifically). I am not quite sure how to classify this last round. Anyways, we move on and hopefully prepare better ones in the future.

screenshot-from-2016-09-16-183548
Here you go 12 participants and the winner is anas_95.

How hard? Well.. I don’t know. 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 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 ?>

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

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.

Code Knights Round 4 ?>

Code Knights Round 4

Assalamualaikum everyone,

Its time for Code Knights Round 4. 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. It would still be a 4 hours round. Additionally, we are adding an additional problems, which means there would be 5 questions in total. The details are as follows.

Date: 30th July 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 this round, please fill up your details in the google forms link above. As usual, if you registered before for the previous rounds, you don’t need to register again. 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 3 Result and Problem Analysis ?>

Code Knights Round 3 Result and Problem Analysis

Salaam everyone,

Last Saturday night, the Code Knights Round 3 was held at 8:00 pm on 16th July and lasted for 4 hours. This time the round had 5 problems to solve and a bit tougher than the previous ones (Round 1 & Round 2).

finalScore
Congratulation to lim2481284 and all participants. Everyone managed to solve at least 1 problem

Needless to say, the participants did well.  The winner of this round is lim2481284 from uniten university who managed to solve 3 problems. Shahril from uitm managed also to solve 3 problems as well, both of them solved A, B and C. However, Shahril was not as fast as lim2481284 and therefore scored the second place. StdLn solved 2 problems, interesting enough he is the only one who solved problem E. It is also interesting to see Foinni who haven’t solved any problem before the freezing of the scoreboard, yet he managed to solve 2 problems in the last hour of the contest rendering him in the fifth place.

Dataset

PDF

Read More Read More