(Subscribe for more such videos) Code : #include using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
can you tell why i am getting run time errror, thanks in advance. code: t = int(input()) for _ in range(t): n = int(input()) a = [int(x) for x in input().split()] po = 0 ni = 0 for x in a: if x > 0: po += 1 else: ni += 1 ma = [i for i in range(1, po+1)] for i in range(ni): ma.append(ma[-1] - 1) mi = [] for i in range(min(po, ni)): mi.append(1) mi.append(0) for i in range(po - ni): mi.append(mi[-1] + 1) print(*ma) print(*mi)
(Subscribe for more such videos)
Code :
#include
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t, n, i, j, po, ne, score, p1, n1;
cin>>t;
for(;t--;)
{
po=ne=0;
cin>>n;
for(i=1; i>j;
if(j>0){
po++;
}else{
ne++;
}
}
p1=po;
n1=ne;
score=0;
for(i=1; i0){
score++;
po--;
}else{
score--;
ne--;
}
cout
question link please i dont know how to find from CF
can you tell why i am getting run time errror, thanks in advance.
code:
t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
po = 0
ni = 0
for x in a:
if x > 0:
po += 1
else:
ni += 1
ma = [i for i in range(1, po+1)]
for i in range(ni):
ma.append(ma[-1] - 1)
mi = []
for i in range(min(po, ni)):
mi.append(1)
mi.append(0)
for i in range(po - ni):
mi.append(mi[-1] + 1)
print(*ma)
print(*mi)
because you are not debugging clearly.
@@aneesbazmi1612 you found the bug?