QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#185266 | #6439. Cloud Retainer's Game | beckham_of_laiwu | WA | 292ms | 9076kb | C++14 | 1.2kb | 2023-09-21 20:19:17 | 2023-09-21 20:19:18 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
const int N = 1e5 + 5;
#define LL long long
struct qwq{
LL x,y,c;
};
qwq a[N * 2];
bool cmp(qwq a,qwq b)
{
if(a.x != b.x) return a.x < b.x;
return a.y < b.y;
}
int T,n,m;
LL H;
int main()
{
scanf("%d",&T);
while(T --)
{
scanf("%lld",&H);
scanf("%d",&n);
for(int i = 1;i <= n;i ++)
{
scanf("%lld%lld",&a[i].x,&a[i].y);
a[i].c = 0;
}
scanf("%d",&m);
for(int i = n + 1;i <= n + m;i ++)
{
scanf("%lld%lld",&a[i].x,&a[i].y);
a[i].c = 1;
}
sort(a + 1,a + n + m + 1,cmp);
map <LL,LL> mp;
mp.clear();
mp[0] = 0;
LL ans = 0;
for(int i = 1;i <= n + m;i ++)
{
if(a[i].c == 1)
{
LL k = (a[i].x + a[i].y) % (2 * H);
mp[k] ++;
ans = max(ans,mp[k]);
k = (2 * H - a[i].y + a[i].x) % (2 * H);
mp[k] ++;
ans = max(ans,mp[k]);
}
else
{
LL k = (a[i].x + a[i].y) % (2 * H);
LL _k = (2 * H - a[i].y + a[i].x) % (2 * H);
LL now = max(mp[k],mp[_k]);
ans = max(ans,now);
mp[k] = now; mp[_k] = now;
}
}
printf("%lld\n",ans);
}
return (0 ^ 0);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4060kb
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: 292ms
memory: 9076kb
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'