Quantcast
Channel: CodeChef Discuss - latest questions
Browsing all 39796 articles
Browse latest View live
↧

RINBOWA-showing wrong answer. why is it so?

include <iostream>using namespace std; int main() { int t,n,a[101],i,j,f;cin>>t; for(i=0;i<t;i++) { cin>>n; for(j=0;j<n;j++) {cin>>a[j];} if(a[n/2]==7) {...

View Article


Why is my rainbow array code giving wrong answer after submission

include<iostream>using namespace std; int main() { bool flag=false; int N,i,t=0; cin>>t; while(t--) { cin>>N; int a[N]; for(i=0;i<n;i++) {="" cin="">>a[i]; }...

View Article


URGENT SOLUTION NEEDED

You are at the best toffee shop in the town. You see that there are different varieties of toffees in the shop. Each type of toffee costs P rupees and contains C calories. You being a student have a...

View Article

a very easy problem

http://www.codechef.com/problems/EASYPROB/ plz explain the question

View Article

Getting 'fatal' error at the IARCS Problem Archive

I am trying to solve this problem. But I am getting a 'fatal' error. I am not able to find the reason of the error as I think this code works fine. Please help me find why this produces a 'fatal'...

View Article


Slow Trains (BUG4EVER 2017) Weird Issue

Here are two of my submissions, exactly same, one in C and the other in C++. The submission in C++ gives an AC verdict while the submission in C gives a WA verdict. The code was originally written in...

View Article

TEST - Editorial

PROBLEM LINK:PracticeAuthor:ADMINEditorialist:SUSHANT AGARWALDIFFICULTY:CAKEWALKPREREQUISITES:Basic looping,Basic Input/OutputPROBLEM:Rewrite small numbers from input to output. Stop processing input...

View Article

Why do I get a SIGSEGV?

Why I am getting a runtime error SIGSEGV in the problem? Where I am going wrong?

View Article


Showing Wrong Answer despite of correct output.

Here is my code to the question#include<stdio.h> #include<math.h> long int A[100005]; long int sum; int main(){ int t,n,i,j; scanf("%d",&t); while(t--){ sum=0; scanf("%d",&n);...

View Article


How to allocate array using malloc

I want to allocate arrays that can store 109 variables , how do I do it ? Here's how I'm doing ,think it's not working int arr; arr= (long long )malloc(100000*sizeof(long long)) Anyone , any...

View Article

How to solve GTREE - "TREE GCD" ?

Problem Link (Contest) - https://www.codechef.com/LOCAUG17/problems/GTREEI tried to solve the above problem from LoC AUG 2017 and wrote a brute force solution (by doing a DFS from each node in its...

View Article

python 3 map problem

a = input() print( map(lambda x,y: x+y ,a.split(" ")))i want to add two numbers

View Article

Why do I get Wrong Answer?

Why is my program getting wrong answer?

View Article


what to write in last name in ICPC registration if I don't have one?

I was registering for ICPC and I realised I couldn't leave the last name field blank, nor can i put characters other than alphabets. I don't have any last name in any official document. What to do?

View Article

Transform the Expression

#include <iostream> #include <cstdlib> #include <cstdio> #include <algorithm> #include <stack> #include <vector> #include <string> using namespace std; typedef...

View Article


Python to pypy

I came to know that pypy is way faster than python and it's syntax are almost similar. But when I had submitted this code it gave me error in pypy but not in pyth .Why is it so? And can someone please...

View Article

Maximum sum subsequence with top down approach

Hello, I am trying to solve the maximum sum subsequence problem, using topdown approach. I am able to come up with an O(n^3) solution, but want an O(n^2) solution. The reason I'm not going with the...

View Article


Eat all apples in the maze

Hello All, I've just started to learn how to solve competitive problems. I met such a problem, but not sure what would be a right way to solve it. Would really appreciate if you can help with that :)...

View Article

SPOJ- PRIME GENERATOR WHY THIS CODE IS SHOWING TLE error.

include<stdio.h>int main() { int t,a,b,i,j,k,ct; scanf("%d",&t); for(i=1;i<=t;i++) { scanf("%d%d",&a,&b); for(j=a;j<=b;j++) { for(k=2,ct=0;k<=j/2;k++) {if(j%k==0) ct++;}...

View Article

Data Structures and Algorithms

Hi all, I need your help to make a list of most used data structures and algorithms along with their tutorials, implementation and some problems on them. It will be helpful to everyone in many ways. I...

View Article
Browsing all 39796 articles
Browse latest View live