So I a few other discussions on SIGSTP and TLE where the problems were spotted to be things like Custom Input box ticked but no input and stuff.
But I’m still not sure why STP appears here, But I’m sure its in the input taking part because I ran without custom input and it ran without errors.
Im solving Problem Code : ZCO14001. Here’s my code:
#include <iostream>
using namespace std;
int main() {
int running = 1;
int N;
int H;
cin >>N >>H;
int* a = new int[N];
int pos=0;
int state = 0;
for (int i=0;i<N;i--){
cin >> a[i];
}
while (running==1){
int c;
cin>>c;
switch(c){
case 0:
running=0;
break;
case 1:
if (pos!=0){
pos--;
}
break;
case 2:
if (pos!=N-1){
pos++;
}
break;
case 3:
if (state!=1 && a[pos]!=0){
a[pos]--;
state=1;
break;
}
case 4:
if (state!=0 && a[pos]!=H){
a[pos]++;
state=0;
break;
}
}
}
return 0;
}
with the custom input
7 4
3 1 2 1 4 0 1
3 2 2 2 2 4 1 3 1 4 0
I do not seem to get it in Visual Studio’s compiler either