QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#524648#1142. Fountain ParksMousa_Aboubaker#0 112ms24028kbC++201.9kb2024-08-19 22:13:062024-08-19 22:13:07

Judging History

你现在查看的是最新测评结果

  • [2024-08-19 22:13:07]
  • 评测
  • 测评结果:0
  • 用时:112ms
  • 内存:24028kb
  • [2024-08-19 22:13:06]
  • 提交

answer

#include "parks.h"
#include <bits/stdc++.h>
using namespace std;

int construct_roads(std::vector<int> x, std::vector<int> y)
{
    map<pair<int, int>, int> found, vis;
    for(int i = 0; i < x.size(); i++)
    {
        found[{x[i], y[i]}] = i;
    }
    queue<pair<int, int>> q;
    q.push({x[0], y[0]});
    vector<int> u, v, a, b;
    while(!q.empty())
    {
        auto [x1, y1] = q.front();
        q.pop();

        vis[{x1, y1}] = true;
        if(found[{x1, y1 + 2}] and !vis[{x1, y1 + 2}])
        {
            if(!vis[{x1 - 1, y1 + 1}])
            {
                u.push_back(found[{x1, y1}]);
                v.push_back(found[{x1, y1 + 2}]);
                a.push_back(x1 - 1);
                b.push_back(y1 + 1);
                q.push({x1, y1 + 2});
            }
            else if(!vis[{x1 + 1, y1 + 1}])
            {
                u.push_back(found[{x1, y1}]);
                v.push_back(found[{x1, y1 + 2}]);
                a.push_back(x1 + 1);
                b.push_back(y1 + 1);
                q.push({x1, y1 + 2});
            }
        }
        else if(found[{x1, y1 - 2}] and !vis[{x1, y1 - 2}])
        {
            if(!vis[{x1 - 1, y1 - 1}])
            {
                u.push_back(found[{x1, y1}]);
                v.push_back(found[{x1, y1 - 2}]);
                a.push_back(x1 - 1);
                b.push_back(y1 - 1);
                q.push({x1, y1 - 2});
            }
            else if(!vis[{x1 + 1, y1 - 1}])
            {
                u.push_back(found[{x1, y1}]);
                v.push_back(found[{x1, y1 - 2}]);
                a.push_back(x1 + 1);
                b.push_back(y1 - 1);
                q.push({x1, y1 - 2});
            }
        }
    }

    if(u.size() != x.size() - 1)
    {
        return 0;
    }

    build(u, v, a, b);
    return 1;
}
// void build(std::vector<int> u, std::vector<int> v, std::vector<int> a, std::vector<int> b);

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 0ms
memory: 3828kb

input:

ba73dbf9c7d5e5202834d6a500541c
1
2 2

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
1
0

result:

ok 

Test #2:

score: 5
Accepted
time: 0ms
memory: 3788kb

input:

ba73dbf9c7d5e5202834d6a500541c
2
2 2
2 4

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
1
1
0 1 1 3

result:

ok 

Test #3:

score: 5
Accepted
time: 0ms
memory: 3808kb

input:

ba73dbf9c7d5e5202834d6a500541c
2
2 2
2 6

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

ok 

Test #4:

score: 5
Accepted
time: 0ms
memory: 3808kb

input:

ba73dbf9c7d5e5202834d6a500541c
3
2 2
2 4
2 6

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
1
2
0 1 1 3
1 2 1 5

result:

ok 

Test #5:

score: 5
Accepted
time: 0ms
memory: 3808kb

input:

ba73dbf9c7d5e5202834d6a500541c
4
2 2
2 4
2 6
2 8

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
1
3
0 1 1 3
1 2 1 5
2 3 1 7

result:

ok 

Test #6:

score: 5
Accepted
time: 0ms
memory: 3804kb

input:

ba73dbf9c7d5e5202834d6a500541c
3
2 2
2 4
2 8

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

ok 

Test #7:

score: 5
Accepted
time: 0ms
memory: 3812kb

input:

ba73dbf9c7d5e5202834d6a500541c
4
2 2
2 4
2 8
2 10

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

ok 

Test #8:

score: 5
Accepted
time: 0ms
memory: 3824kb

input:

ba73dbf9c7d5e5202834d6a500541c
4
2 2
2 4
2 6
2 10

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

ok 

Test #9:

score: 0
Wrong Answer
time: 112ms
memory: 24028kb

input:

ba73dbf9c7d5e5202834d6a500541c
100000
2 15660
2 23918
2 132200
2 117654
2 162750
2 183010
2 75554
2 29740
2 185476
2 135138
2 194024
2 182274
2 1338
2 42922
2 51616
2 171196
2 159598
2 136432
2 84454
2 61806
2 136968
2 167442
2 150036
2 23974
2 10064
2 86342
2 146274
2 174318
2 130832
2 118838
2 180...

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

wrong answer Solution announced impossible, but it is possible.

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #82:

score: 0
Wrong Answer
time: 0ms
memory: 3872kb

input:

ba73dbf9c7d5e5202834d6a500541c
3
200000 2
200000 4
199998 2

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

wrong answer Solution announced impossible, but it is possible.

Subtask #5:

score: 0
Wrong Answer

Test #108:

score: 0
Wrong Answer
time: 91ms
memory: 18788kb

input:

ba73dbf9c7d5e5202834d6a500541c
200000
82422 100002
100002 52498
82816 2
97624 2
100002 58032
20638 100002
100002 7646
80512 2
2 10584
28426 100002
2 83036
2 64556
47872 100002
55196 2
85350 100002
2 95376
2 23942
12488 100002
83178 2
2 9086
85598 2
100002 78820
100002 10868
98810 2
84182 100002
2 71...

output:

3kr2yac8xnf3ktgcoqviaw115df6rra7is6p5uix
OK
0

result:

wrong answer Solution announced impossible, but it is possible.

Subtask #6:

score: 0
Skipped

Dependency #1:

0%