QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#256404 | #6439. Cloud Retainer's Game | Satsuki# | WA | 245ms | 10308kb | C++17 | 1.2kb | 2023-11-18 19:11:38 | 2023-11-18 19:11:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const int N = 200010;
bool st[N];
int pr[N],cnt;
struct point
{
int x,y,op;
}p[N];
bool cmp(point x,point y)
{
return x.x > y.x;
}
map<int,int> mp;
void solve()
{
int h;cin >> h;
mp.clear();
int n;cin >> n;
for(int i = 1;i <= n;i++)
{
cin >> p[i].x >> p[i].y;
p[i].op = 1;
}
int m;cin >> m;
for(int i = 1;i <= m;i++)
{
cin >> p[i + n].x >> p[i + n].y;
p[i + n].op = 2;
}
sort(p + 1,p + 1 + n + m, cmp);
for(int i = 1;i <= n + m;i++)
{
int t = p[i].op;
int x = p[i].x,y = p[i].y;
// cout << x << endl;
if(t == 2)
{
mp[(x - y) % (2 * h)]++;
// cout << (x - y) % (2 * h) <<" " << ((2 * h - x - y) % (2 * h) + 2 * h) % (2 * h) << endl;
// cout << x <<" << y << endl;
mp[((2 * h - x - y) % (2 * h) + 2 * h) % (2 * h)]++;
}
else
{
int mx = max(mp[(x - y) % (2 * h)],mp[((2 * h - x - y) % (2 * h) + 2 * h) % (2 * h)]);
mp[(x - y) % (2 * h)] = mx;
mp[((2 * h - x - y) % (2 * h) + 2 * h) % (2 * h)] = mx;
}
}
cout << mp[0] << endl;
}
signed main()
{
ios::sync_with_stdio(false);cin.tie(0);
int T;cin >> T;
while(T--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3360kb
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: 245ms
memory: 10308kb
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:
1 1 2 1 3 2 0 2 6 6 1 1 0 0 1 3 1 1 0 1 0 0 3 1 1 3 2 3 1 1 1 2 0 1 5 1 1 1 0 1 3 1 3 3 3 3 2 1 0 3 1 2 2 0 5 1 1 0 1 2 2 3 1 0 1 1 1 3 2 2 2 1 1 3 2 2 0 0 3 4 5 1 1 1 1 1 0 2 0 0 3 0 2 2 0 1 0 1 2 1 3 4 3 2 2 4 2 4 2 1 2 1 0 1 4 0 3 0 2 1 0 2 6 1 2 2 1 0 1 4 0 2 3 1 2 2 1 0 2 3 2 0 0 4 1 1 1 0 3 2 ...
result:
wrong answer 1st numbers differ - expected: '2', found: '1'