QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#723569#6439. Cloud Retainer's Gamek1ritoWA 337ms8988kbC++201.4kb2024-11-07 22:56:272024-11-07 22:56:27

Judging History

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

  • [2024-11-07 22:56:27]
  • 评测
  • 测评结果:WA
  • 用时:337ms
  • 内存:8988kb
  • [2024-11-07 22:56:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define db double
const int mod=1e9+7;
const int N=2e5+100;
const db PI=acos(-1);
int T,n,m,H,cnt,ans;
map<int,int> f;
struct node
{
    int x,y,id;
}a[N];
bool cmp(node a,node b)
{
    if(a.x==b.x) return a.y>b.y;
    return a.x>b.x;
}
void init()
{
    f.clear();
    cnt=ans=0;
}
signed main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>T;
    while(T--)
    {
        cin>>H>>n;
        H*=2;
        for(int i=1;i<=n;i++)
        {
            int x,y;
            cin>>x>>y;
            a[++cnt].id=0;
            a[cnt].x=x,a[cnt].y=y;
        }
        cin>>m;
        for(int i=1;i<=m;i++)
        {
            int x,y;
            cin>>x>>y;
            a[++cnt].id=1;
            a[cnt].x=x,a[cnt].y=y;
        }
        sort(a+1,a+1+cnt,cmp);
        for(int i=1;i<=cnt;i++)
        {
            int v1=(a[i].x+a[i].y)%H,v2=(a[i].x-a[i].y+H)%H;
            if(!a[i].id)
            {
                f[v1]=f[v2]=max(f[v1],f[v2]);
            }
            else
            {
                f[v1]++;
                f[v2]++;
            }
            ans=max(ans,max(f[v1],f[v2]));
            // cout<<i<<" : "<<a[i].x<<" "<<a[i].y<<" "<<v1<<" "<<v2<<" "<<f[v1]<<" "<<f[v2]<<endl;
        }
        cout<<ans<<"\n";
        init();
    }
}

詳細信息

Test #1:

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

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: 337ms
memory: 8988kb

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:

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

result:

wrong answer 1st numbers differ - expected: '2', found: '3'