QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673255#6439. Cloud Retainer's GameetherealUnicornWA 316ms6456kbC++141.5kb2024-10-24 21:24:402024-10-24 21:24:41

Judging History

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

  • [2024-10-24 21:24:41]
  • 评测
  • 测评结果:WA
  • 用时:316ms
  • 内存:6456kb
  • [2024-10-24 21:24:40]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;
const int INF = 1e9;

enum Type
{
    board,
    coin
};
struct Obj
{
    int x, y;
    Type type;
} obj[2 * N];
map<int, int> ans;

bool cmp(Obj a, Obj b) { return a.x < b.x; }
inline int query(int x) { return (ans.find(x) == ans.end() ? -INF : ans[x]); }
int init();
int solve(int cnt, int h);

int main()
{
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int t, h, cnt;
    cin >> t;
    while (t--)
    {
        cin >> h;
        cout << solve(init(), h) << endl;
    }
    return 0;
}

int init()
{
    int n, m, x, y;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> obj[i].x >> obj[i].y;
        obj[i].type = board;
    }
    cin >> m;
    for (int i = n + 1; i <= n + m; i++)
    {
        cin >> obj[i].x >> obj[i].y;
        obj[i].type = coin;
    }
    sort(obj + 1, obj + n + m + 1, cmp);
    ans.clear();
    ans[0] = 0;
    return n + m;
}

int solve(int cnt, int h)
{
    int x, y, pos1, pos2;
    h = 2 * h;
    for (int i = 1; i <= cnt; i++)
    {
        x = obj[i].x, y = obj[i].y;
        pos1 = (x + y) % h, pos2 = (h - y + x) % h;
        if (obj[i].type == coin)
        {
            ans[pos1] = query(pos1) + 1;
            ans[pos2] = query(pos2) + 1;
        }
        else
            ans[pos1] = ans[pos2] = max(ans[pos1], ans[pos2]);
    }
    int ret = 0;
    for (auto i : ans)
        ret = max(ret, i.second);
    return ret;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3560kb

input:

2
4
3
1 1
2 2
6 2
4
3 1
3 3
5 1
7 3
3
1
4 2
3
1 1
6 2
9 1

output:

3
3

result:

ok 2 number(s): "3 3"

Test #2:

score: -100
Wrong Answer
time: 316ms
memory: 6456kb

input:

5503
10
19
2 4
2 8
8 3
8 4
8 7
2 7
2 6
1 5
3 2
6 4
2 1
4 5
2 5
7 1
4 7
5 7
2 2
8 6
8 1
12
5 1
4 8
5 2
6 1
3 6
1 1
1 7
7 2
5 6
6 8
1 2
3 5
10
5
9 5
10 7
6 6
5 7
1 3
9
6 8
8 8
6 4
2 9
5 4
4 2
10 9
2 3
2 1
7
1
4 3
14
4 6
6 1
2 1
7 6
2 3
4 4
5 3
6 5
1 4
3 4
3 2
6 2
8 6
8 2
6
6
5 2
5 1
3 1
2 3
7 4
5 5
3
...

output:

2
1
2
1
3
3
3
3
4
6
2
2
1
1
2
2
2
3
3
2
1
0
2
1
2
3
3
3
3
3
1
3
1
4
5
2
3
1
0
2
3
4
2
3
3
3
2
1
0
3
1
3
2
2
4
1
2
1
3
2
3
3
3
1
2
2
2
3
2
4
2
1
1
3
2
3
0
1
3
4
5
2
2
1
1
3
1
3
0
1
3
1
3
3
2
2
1
3
4
3
3
4
4
2
3
4
2
4
3
4
2
1
0
1
3
1
3
1
3
2
1
3
5
1
4
2
2
0
2
3
1
3
3
2
4
2
2
1
3
3
2
1
1
3
1
2
3
1
4
3
...

result:

wrong answer 6th numbers differ - expected: '2', found: '3'