You should probably find the distance and apply Pythagoras theorem…
According to your solution , think like this -Two scalene triangle can also be on same coordinates. I hope you get it .
Problem Code - MAXORSUM
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,m;
cin>>n>>m;
int arr[n];
int brr[n];
// the maximum output will be if i apply the xor on starting m elements //
long long i,j;
for(i=0;i<n;i++)
{
cin>>arr[i];
}
for(j=0;j<n;j++)
{
cin>>brr[j];
}
// now… i will remove the first m elements of arr[] and find the sum
long long sum = 0;
for(i=m;i<n;i++)
{
sum = sum + arr[i];
}
cout<<sum<<endl;
}
Why i am getting Runtime Error - SIGEMT
The logic might be incorrect…but why Runtime Error ?
Hello,
I am getting SIGTSTP error with the test input 3 for the below problem (MULTHREE):
My code works well for the first two test inputs.
Here is the code I have attached:
https://www.codechef.com/viewsolution/39959901
Thank you
you have to use long long int while printing lcm.
i was trying the question of rainbow array in beginner’s section and here’s my code:-
try:
t=int(input())
li=[1,2,3,4,5,6,7,8,9,10]
l=[];y=''
is_this_true=True
for i in range(t):
le=int(input())
l+=map(int,input().split())
cnt=l.count(7)
mid =le//2
for k in l:
if k not in li:
is_this_true=False
break
for j in range(mid):
if (l[mid-j]==l[mid+j]) and (l[j]+1==l[j+1] or l[j]==l[j+1]) and (is_this_true) and l[mid]==7 and cnt%2!=0:
y="yes"
else:
y="no"
break
print(y)
l=[]
except:
pass
i don’t know what is wrong with this code.Please help!!
i tried the suggested input in following code:-
t=int(input())
li=[1,2,3,4,5,6,7]
y=’’;l=[]
is_this_true=True
for i in range(t):
le=int(input())
l+=(map(int,input().split()))
mid =le//2
for k in li:
if k not in l:
is_this_true=False
break
for j in range(mid):
if (l[mid-j]==l[mid+j]) and (l[j]+1==l[j+1] or l[j]==l[j+1]) and (is_this_true) and l[mid]==7:
y=“yes”
else:
y=“no”
break
print(y)
l=[]
is the answer “no” for this input??
The expected output for the test input:
1
13
2 2 3 4 5 6 7 6 5 4 3 2 2
is indeed no
- otherwise, what would a_1 be?
i am also getting “no”, but my code is still wrong…
Please either format your new code or (better!) link to your submission - the forum software has mangled it and it won’t compile!
Consider the test input:
3
14
1 2 3 4 5 6 7 6 5 4 3 2 1 1
13
1 2 3 4 5 6 8 6 5 4 3 2 1
19
1 2 3 4 4 5 6 6 6 7 6 6 6 5 4 4 3 2 1
thanks, i understood my mistake.
this is a partially correct answer, I am not getting the cases that might give error…please suggest some cases that might go wrong in this code of " chef and pairs"
https://www.codechef.com/viewsolution/56786343
i am getting this code wrong but i am getting all the given results correctly…please point out the mistake…!!
https://www.codechef.com/viewsolution/57409941
Your solution gives the wrong output for the test input:
1
aabbcccddddd
Is the answer Dynamic as 2+3=5???(2a ,3c and 5d)
No, it’s not Dynamic.
What permutation C have you chosen?