I am about to organize a contest for my college on CodeChef via HostYourContest. I want to post the editorials for the same after the contest is over. Is there any guideline or procedure to follow? asked 30 Oct '13, 12:00

You need to post the editorials from your own CodeChef id once the contest is over. Following are some guidelines that you need to keep in mind while posting the editorials : 1. Format :You need to post the editorials on discuss.codechef.com in wiki markdown. 2. Tags :Tags field is an important field to allow easy searching of the editorial. You need to enter tags for the editorial as follows:
3. Type :You need to mark the editorial as Community Wiki by clicking on the community wiki check box. 4. Template :Template for the Editorial can be found here. You must not miss on reading a very awesome write up on How to make a good editorial by Pradeep George Mathias.answered 30 Oct '13, 12:53

I'm trying to upload the editorial of a contest hosted by me. www.codechef.com/QBIT15. It seems I don't have enough karma to post . What do I do? answered 16 Oct '15, 12:25

CDIYPA01: Editorial Author: rohit74 Tester :mkmukesh Editorialist:mkmukesh Difficulty: Easy PREREQUISITES: Hashing or C++ STL knowledge about Map PROBLEM ….. Solution: If you are using simple sorting algorithm for this problem and then solving it for position then your code would take O(nlogn) time but if you want to utilize this problem then you can use map technique of C++ STL from using this technique you can solve this problem in O(n) time complexity. The code is given below that take O(n) time is: include<bits stdc++.h="">using namespace std; define ll long longint main() { map<ll int,int=""> m; int t,i,n,count; cin>>t; while(t) { cin>>n; ll int ar[n]; count=0; for(i=0;i<n;i++) {="" cin="">>ar[i]; m[ar[i]]=0; } map<ll int,int="">::iterator p=m.begin(); while(p!=m.end()) { m[p>first]=++count; p++; } for(i=0;i<n;i++) cout<<m[ar[i]]<<" "; cout<<endl; } } answered 27 Feb '17, 02:02

CDIYPA02: Editorial Author: rohit74 Tester :mkmukesh Editorialist:mkmukesh Difficulty: Medium PREREQUISITES: Basic knowledge of sorting such as merge and quick sort PROBLEM ….. Solution: If you are using simply using loop concept then this problem take O(n^2) time complexity is worst time for finding such difference whose sum is equal to difference of any two elements but you can improve your source code running time complexity if you using merge sort O(nlogn) and binary search O(logn) in worst time. So, your code will take simply O(nlogn) time . the solution is given below: include<stdio.h>void findPair(int [],int ,int); void merge(int a[], int low, int mid, int high) { int b[10000]; int i = low, j = mid + 1, k = 0;
} void mergesort(int a[], int low, int high) { if (low < high) { int m = (high + low)/2; mergesort(a, low, m); mergesort(a, m + 1, high); merge(a, low, m, high); } } int main(){ int t; scanf("%d",&t); while(t){ int n; scanf("%d",&n); int a[n],i; for(i=0;i<n;i++){ scanf("%d",&a[i]); } int sum=0; for(i=0;i<n;i++){ int x=a[i]; int m=0,d=0; while(x!=0){ d=x%10; if(m<d) m=d; x=x/10; } sum+=m; } mergesort(a,0,n1); findPair(a,n,sum); printf("\n"); } return 0; } void findPair(int arr[], int size, int n) { // Initialize positions of two elements int i = 0; int j = 1;
} answered 27 Feb '17, 02:03

CDIYPA03: Editorial Author: rohit74 Tester :mkmukesh Editorialist:mkmukesh Difficulty: Easy PREREQUISITES: basic knowledge of char array and binary number PROBLEM ….. Solution: This is quite simple problem in which you have simply take an char array and store remainder of a given number dividing by 2 till the number not gets zero. And finally you get char array in which numbers are in reverse order so, take an temp array in which reverse loop the first array and position the element in temp array from 0th to (n1)th position. And finally according to given problem situation at position k flip 1 to 0 and 0 to 1. And then convert final binary number into decimal number . in all this process this take O(n) time complexity. include <iostream>using namespace std; int main() { int t; cin>>t; while(t){ unsigned long long int n,k; cin>>n>>k; unsigned long long int b=0; unsigned long long int i=1; while(n!=0){
} answered 27 Feb '17, 02:04

CDIYPA04: Editorial Author: rohit74 Tester :mkmukesh Editorialist:mkmukesh Difficulty: Medium PREREQUISITES: Knowledge about recursion PROBLEM ….. Solution: The recursion technique sometimes is most appropriate than the iteration technique. Here according to given problem you have to use a recursive function: int buff_master(int n,int k){ if(n==1){ return n; } else{ return (buff_master(n1,k)+k1)%n+1; } } answered 27 Feb '17, 02:05
