agrawal-d/cph

The first testcase is always display Time-out

Closed this issue · 6 comments

cn-ryh commented

Extension Version: v5.13.0

VS Code Version: v1.79.2

Browser Version: Version 114.0.5735.134 (Official Build) (64-bit)

Operating System: Windows 11 x64

The first testcase is always display Time-out.

The reason seems to be that the plug-in counts the time spent compiling in the first test point.

same as #324

Can u post a sample code and test case where u found this inconsistency?

cn-ryh commented

Can u post a sample code and test case where u found this inconsistency?
Yes, example codes and testcases are here, but in my computer, all the codes have the same problem, even though is only print "Hello World".

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define max_n 201101
void read(int &p)
{
    p = 0;
    int k = 1;
    char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-')
        {
            k = -1;
        }
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        p = p * 10 + c - '0';
        c = getchar();
    }
    p *= k;
    return;
}
void write_(int x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x > 9)
    {
        write_(x / 10);
    }
    putchar(x % 10 + '0');
}
void writesp(int x)
{
    write_(x);
    putchar(' ');
}
void writeln(int x)
{
    write_(x);
    putchar('\n');
}
int n;
char s[max_n];
int st[max_n];
int bg[max_n], ed[max_n], tot;
int cf[max_n], sum[max_n];
signed main()
{
#if _clang_
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
#endif
    read(n);
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == '(')
        {
            st[++st[0]] = i;
        }
        if (s[i] == ')' && st[0])
        {
            cf[st[st[0]--]]++;
            cf[i + 1]--;
        }
    }
    int now = 0;
    for (int i = 1; i <= n; i++)
    {
        now += cf[i];
        if (now > 0)
        {
            continue;
        }
        putchar(s[i]);
    }
    return 0;
}

image

cn-ryh commented

Can u post a sample code and test case where u found this inconsistency?

As you see, the first testcase, not very big but have a very long time.
Actually, it's only takes 3ms on the online Judge Website Test.

Thanks for the code sample. I'll be looking at this

I am facing this error,,,, SIGTERM
Sometimes it gives the output but most of the time it takes time after that showing SIGTERM ....I reset all the setting of this extension still not working ,,,,If anyone know the solution ,,,Please help me . Thank you.