QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133142#2674. Vision programbashkort#0 1ms4140kbC++203.5kb2023-08-01 16:22:222024-07-04 01:06:49

Judging History

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

  • [2024-07-04 01:06:49]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4140kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-01 16:22:22]
  • 提交

answer

#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

struct SegmentTree {
    vector<int> t;
    int sz = 1;

    void init(const vector<int> &a) {
        sz = size(a);
        t.resize(sz * 4);
        build(1, 0, sz, a);
    }

    void build(int x, int lx, int rx, const vector<int> &a) {
        if (lx + 1 == rx) {
            t[x] = a[lx];
        } else {
            build(x << 1, lx, lx + rx >> 1, a);
            build(x << 1 | 1, lx + rx >> 1, rx, a);
            t[x] = add_or({t[x << 1], t[x << 1 | 1]});
        }
    }

    void rangeSum(int l, int r, vector<int> &a, int x, int lx, int rx) {
        if (l >= rx || lx >= r) {
            return;
        }
        if (l <= lx && rx <= r) {
            return a.push_back(t[x]);
        }
        int mid = lx + rx >> 1;
        rangeSum(l, r, a, x << 1, lx, mid);
        rangeSum(l, r, a, x << 1 | 1, mid, rx);
    }

    void rangeOr(int l, int r, vector<int> &a) {
        rangeSum(l, r, a, 1, 0, sz);
    }
};

void construct_network(int H, int W, int K) {
    vector pos1(H, vector<int>(W, -1)), pos2(pos1);
    map<int, vector<int>> mp1, mp2;
    map<int, SegmentTree> st1, st2;

    auto toi = [&](int x, int y) {
        return x * W + y;
    };


//    cout << "here!" << endl;

    for (int sum = 0; sum < H + W; ++sum) {
        int top = 0;
        for (int x = 0; x <= sum; ++x) {
            int y = sum - x;
            if (y < W && x < H) {
                mp1[sum].push_back(toi(x, y));
                pos1[x][y] = top++;
            }
        }
    }

//    cout << "here!" << endl;

    for (int sum = -H + 1; sum < W; ++sum) {
        int top = 0;
        for (int x = 0; x < H; ++x) {
            int y = sum + x;
            if (x >= 0 && x < H && y < W) {
                mp2[sum].push_back(toi(x, y));
                pos2[x][y] = top++;
            }
        }
    }

//    cout << "here!" << endl;

    for (auto [x, y] : mp1) {
//        cout << "st1: " << x << endl;
        st1[x].init(y);
    }
    for (auto [x, y] : mp2) {
//        cout << "st2: " << x << endl;
        st2[x].init(y);
    }


//    cout << "here!" << endl;

    vector<int> orz;

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            vector<int> a;
            int lx = 1e9, rx = -1, sum = -1;
            for (int x1 = 0; x1 <= i; ++x1) {
                int y1 = j - (K - (i - x1));
                if (y1 <= j && y1 >= 0 && y1 < W) {
                    int p = pos1[x1][y1];
                    assert((sum == -1 || sum == x1 + y1) && p != -1);
                    sum = x1 + y1;
                    lx = min(lx, p);
                    rx = max(rx, p + 1);
                }
            }
            if (sum != -1) {
                st1[sum].rangeOr(lx, rx, a);
            }
            lx = 1e9, rx = -1, sum = -1;
            for (int x1 = 0; x1 <= i; ++x1) {
                int y1 = j + (K - (i - x1));
                if (y1 >= j && y1 >= 0 && y1 < W) {
                    int p = pos2[x1][y1];
                    assert((sum == -1 || sum == y1 - x1) && p != -1);
                    sum = y1 - x1;
                    lx = min(lx, p);
                    rx = max(rx, p + 1);
                }
            }
            if (sum != -1) {
                st2[sum].rangeOr(lx, rx, a);
            }
            if (!a.empty()) {
                orz.push_back(add_and({toi(i, j), add_or(a)}));
            }
        }
    }

    add_or(orz);
}


Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 0ms
memory: 4060kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 3 1
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
7
1 1 1
0 2 0 3
1 2 0 2
0 2 1 5
1 1 1
0 2 2 7
1 3 4 6 8

result:

ok 

Test #2:

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

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 3 2
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
5
1 1 2
0 2 0 3
1 1 0
0 2 2 5
1 2 4 6

result:

ok 

Test #3:

score: -10
Wrong Answer
time: 0ms
memory: 3780kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
3 1 1
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
WA
Invalid index

result:

wrong answer WA in grader: Invalid index

Subtask #2:

score: 0
Runtime Error

Test #19:

score: 11
Accepted
time: 0ms
memory: 3728kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 9 3
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
19
1 1 3
0 2 0 9
1 1 4
0 2 1 11
1 1 5
0 2 2 13
1 2 0 6
0 2 3 15
1 2 1 7
0 2 4 17
1 2 2 8
0 2 5 19
1 1 3
0 2 6 21
1 1 4
0 2 7 23
1 1 5
0 2 8 25
1 9 10 12 14 16 18 20 22 24 26

result:

ok 

Test #20:

score: -11
Runtime Error

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
9 1 5
-1

output:

Unauthorized output

result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Runtime Error

Test #48:

score: 12
Accepted
time: 1ms
memory: 3908kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 199 1
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
399
1 1 1
0 2 0 199
1 2 0 2
0 2 1 201
1 2 1 3
0 2 2 203
1 2 2 4
0 2 3 205
1 2 3 5
0 2 4 207
1 2 4 6
0 2 5 209
1 2 5 7
0 2 6 211
1 2 6 8
0 2 7 213
1 2 7 9
0 2 8 215
1 2 8 10
0 2 9 217
1 2 9 11
0 2 10 219
1 2 10 12
0 2 11 221
1 2 11 13
0 2 12 223
1 2 12 14
0 2 1...

result:

ok 

Test #49:

score: 0
Accepted
time: 1ms
memory: 3908kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 199 99
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
399
1 1 99
0 2 0 199
1 1 100
0 2 1 201
1 1 101
0 2 2 203
1 1 102
0 2 3 205
1 1 103
0 2 4 207
1 1 104
0 2 5 209
1 1 105
0 2 6 211
1 1 106
0 2 7 213
1 1 107
0 2 8 215
1 1 108
0 2 9 217
1 1 109
0 2 10 219
1 1 110
0 2 11 221
1 1 111
0 2 12 223
1 1 112
0 2 13 225
1...

result:

ok 

Test #50:

score: 0
Accepted
time: 1ms
memory: 4140kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 199 100
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
397
1 1 100
0 2 0 199
1 1 101
0 2 1 201
1 1 102
0 2 2 203
1 1 103
0 2 3 205
1 1 104
0 2 4 207
1 1 105
0 2 5 209
1 1 106
0 2 6 211
1 1 107
0 2 7 213
1 1 108
0 2 8 215
1 1 109
0 2 9 217
1 1 110
0 2 10 219
1 1 111
0 2 11 221
1 1 112
0 2 12 223
1 1 113
0 2 13 225
...

result:

ok 

Test #51:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
1 199 198
-1

output:

b17553fd-ba5a-4140-836c-491f938c515b
OK
5
1 1 198
0 2 0 199
1 1 0
0 2 198 201
1 2 200 202

result:

ok 

Test #52:

score: -12
Runtime Error

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
199 1 2
-1

output:

Unauthorized output

result:


Subtask #6:

score: 0
Wrong Answer

Test #70:

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

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
2 2 1
3 128
128 129
128 130
128 131

output:

b17553fd-ba5a-4140-836c-491f938c515b
WA
Invalid index

result:

wrong answer WA in grader: Invalid index

Subtask #7:

score: 0
Runtime Error

Test #101:

score: 0
Runtime Error

input:

c2675211-ade0-44b0-8c15-741dd835f3d2
200 200 1
100 524
24804 34853
20956 34628
18830 29184
28919 32573
11364 24911
2226 5624
3715 30838
2206 17143
21162 27531
20198 27242
5007 12724
27160 32586
3535 7307
17015 25466
626 13891
9132 26194
9198 33073
815 7328
6938 21395
9489 30995
10804 21530
14698 394...

output:

Unauthorized output

result:


Subtask #8:

score: 0
Skipped

Dependency #1:

0%