QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601055#6439. Cloud Retainer's GameneetmanRE 0ms3788kbC++141.2kb2024-09-29 20:43:562024-09-29 20:44:00

Judging History

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

  • [2024-09-29 20:44:00]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3788kb
  • [2024-09-29 20:43:56]
  • 提交

answer

#include<algorithm>
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
const int N = 2e5 + 5;
int n, m, H;
struct node{
    int x, y, op;
}nod[N];

int main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int T;
    cin >> T;
    while(T --){
        cin >> H;
        cin >> n;
        for(int i = 1; i <= n; i ++){
            cin >> nod[i].x >> nod[i].y;
            nod[i].op = 0;
        }
        cin >> m;
        for(int i = 1; i <= m; i ++){
            cin >> nod[i + n].x >> nod[i + n].y;
            nod[i + n].op = 1;
        }
        sort(nod + 1, nod + 1 + n + m, [](node x,node y){
            return x.x > y.y;
        });
        map <int, int> f;
        for(int i = 1; i <= n + m; i ++){
            if(nod[i].op){
                f[(nod[i].x + nod[i].y) % (2 * H)] ++;
                f[(0ll + 2 * H - nod[i].y + nod[i].x) % (2 * H)] ++;
            }
            else{
                f[(nod[i].x + nod[i].y) % (2 * H)] = f[(0ll + 2 * H - nod[i].y + nod[i].x) % (2 * H)]
                = max(f[(nod[i].x + nod[i].y) % (2 * H)], f[(0ll + 2 * H - nod[i].y + nod[i].x) % (2 * H)]);
            }
        }
        cout << f[0] << '\n';
    }
    return 0;
}

詳細信息

Test #1:

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

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
Runtime Error

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:


result: