2632021-04-07 18:25:46pgergo032015. szeptembercpp11Wrong answer on test 332ms2296 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

typedef struct
{
    double x,y,r;
    vector<int> s;
    bool t, a;
    bool bejart;
}Kor;

Kor k[101];
int db=0;
bool bejar(int p, bool avan, bool tvan)
{
    queue<int> q;
    q.push(p);
    while(!q.empty())
    {
        p=q.front();
        q.pop();
        k[p].bejart=true;
        if(k[p].a)
            avan=true;
        if(k[p].t)
            tvan=true;
        if(avan && tvan)
            return true;
        for(int i=0; i<k[p].s.size(); i++)
            if(!k[k[p].s[i]].bejart)
                q.push(k[p].s[i]);
    }
    return false;
}

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    for(int i=0; i<K; i++)
    {
        cin >> k[i].x >> k[i].y >> k[i].r;
        for(int j=0; j<i; j++)
        {
            if(sqrt(pow(abs(k[i].x-k[j].x),2)+pow(abs(k[i].y-k[j].y),2))<=k[i].r+k[j].r)
            {
                k[i].s.push_back(j);
                k[j].s.push_back(i);
            }
            k[i].t=k[i].a=false;
            if(k[i].y-k[i].r<=0)
                k[i].t=true;
            if(k[i].y+k[i].r>=M)
                k[i].a=true;
            k[i].bejart=false;
        }
    }

    bool nem=false;
    for(int i=0; i<K; i++)
    {
        if(k[i].bejart)
            continue;

        if(k[i].a && k[i].t)
        {
            cout << "Nem vezet" << endl;
            nem=true;
            break;
        }
        else if(k[i].a)
        {
            if(bejar(i, true, false))
            {
                cout << "Nem vezet" << endl;
                nem=true;
                break;
            }
        }
        else if(k[i].t)
        {
            if(bejar(i, false, true))
            {
                cout << "Nem vezet" << endl;
                nem=true;
                break;
            }
        }
    }
    if(!nem)
        cout << "Vezet" << endl;

    return 0;
}
1 - Accepted
Memory: 2084KiB
Time: 2ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

2 - Accepted
Memory: 2088KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

3 - Accepted
Memory: 2140KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

4 - Accepted
Memory: 2144KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

5 - Accepted
Memory: 2148KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

6 - Accepted
Memory: 2180KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

7 - Accepted
Memory: 2160KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

8 - Accepted
Memory: 2204KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

9 - Accepted
Memory: 2192KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

10 - Accepted
Memory: 2172KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

11 - Accepted
Memory: 2168KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

12 - Accepted
Memory: 2212KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

13 - Accepted
Memory: 2184KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

14 - Accepted
Memory: 2184KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

15 - Accepted
Memory: 2196KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

16 - Accepted
Memory: 2248KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

17 - Accepted
Memory: 2196KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

18 - Accepted
Memory: 2208KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

19 - Accepted
Memory: 2224KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

20 - Accepted
Memory: 2228KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

21 - Accepted
Memory: 2228KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

22 - Accepted
Memory: 2268KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

23 - Accepted
Memory: 2272KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

24 - Accepted
Memory: 2276KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

25 - Accepted
Memory: 2284KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

26 - Accepted
Memory: 2288KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

27 - Accepted
Memory: 2288KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

28 - Accepted
Memory: 2296KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

29 - Accepted
Memory: 2240KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

30 - Accepted
Memory: 2248KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

31 - Accepted
Memory: 2252KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

32 - Accepted
Memory: 2256KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

33 - Wrong answer
Memory: 2256KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Nem vezet
Checker output:
wrong answer 1st words differ - expected: 'Nem', found: 'Vezet'