首页 > 解决方案 > 某些在线 ide 中出现 SIGTSTP 错误,但程序在我的终端中运行良好

问题描述

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n;
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        int c=0;int C[t]={};
        cin>>n;
        int P[n]={};int G[n]={};
        for(int j=0;j<n;j++)
        {
            cin>>P[j];
        }
        for(int k=0;k<n;k++)
        {
            int asn=1;int b=5;
            if(k!=0)
            {
            if(k<5)
            {
                for(int l=0;l<k;l++)
                {
                    if(P[l]<P[k])
                    {
                        asn*=0;
                    }

                }
            }
            else
            {
                while(b>0)
                {
                    if(P[k-b]<P[k])
                    {
                        asn*=0;
                    }

                    b--;
                }
            }
            }
            G[k]=asn;
        }

    for(int f=0;f<n;f++)
    {
        if(G[f]==1)
        {
            c++;
        }
    }
  cout<<c<<"\n";
    }
}

谁能帮我找出这段代码中的 SIGTSTP 错误。在我的电脑中,这个程序运行良好,但在 Codechef 的在线 IDE 中编译时出现运行时错误。问题的链接是https://www.codechef.com/OCT19B/problems/S10E

标签: c++runtime

解决方案


推荐阅读