QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#648402#6439. Cloud Retainer's GameMENDAXWA 444ms14884kbC++201.9kb2024-10-17 18:49:292024-10-17 18:49:30

Judging History

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

  • [2024-10-17 18:49:30]
  • 评测
  • 测评结果:WA
  • 用时:444ms
  • 内存:14884kb
  • [2024-10-17 18:49:29]
  • 提交

answer

#include<bits/stdc++.h>

#define int long long
#define x first
#define y second
#define endl '\n'

using namespace std;

const int N=1e6+10;
typedef pair<int,int> PII;
typedef pair<PII,int> PIII;

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}

map<int,int>ma[2];
int cnt;
/*
ma[0][i]:表示向下,ma[1][i]表示向上走 
*/

void slove(){
	cnt++;
	int H;cin>>H;
	vector<PIII> val; 
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		int x,y;cin>>x>>y;
		val.push_back({{x,y},0});//0表示木板 
	}
	int m;cin>>m;
	for(int i=1;i<=m;i++){
		int x,y;cin>>x>>y;
		val.push_back({{x,y},1});
	}
	sort(val.begin(),val.end());
	//以x=0为基准线
	ma[0].clear(),ma[1].clear();
	ma[1][0]=0;
	int ans=0;
	if(cnt==76){
		cout<<H<<"."<<n<<"."<<m<<"..";
		for(auto zz:val)cout<<"?"<<zz.x.x<<"."<<zz.x.y<<"."<<zz.y<<"?";
		return ;
	}
	for(auto zz:val){
		int x=zz.x.x,y=zz.x.y,op=zz.y;
		int step=x%(2*H);
		//1.转移向下走的情况 
		int y1=y+step,r1;
		if(y1>H){
			if(!ma[1].count(2*H-y1))ma[1][2*H-y1]=-1e9;
			r1=ma[1][H-(y1-H)];
			if(op==1)ma[1][H-(y1-H)]++;
			ans=max(ans,ma[1][2*H-y1]);
		}else {
			if(!ma[0].count(y1))ma[0][y1]=-1e9;
			r1=ma[0][y1];
			if(op==1)ma[0][y1]++;
			ans=max(ans,ma[0][y1]);
		}
		int y2=y-step;
		int r2;
		if(y2<0){
			if(!ma[0].count(-y2))ma[0][-y2]=-1e9;
			r2=ma[0][-y2];
			if(op==1)ma[0][-y2]++;
			ans=max(ans,ma[0][-y2]);
		}else {
			if(!ma[1].count(y2))ma[1][y2]=-1e9;
			r2=ma[1][y2];
			if(op==1) ma[1][y2]++;
			ans=max(ans,ma[1][y2]);
		}
		if(op==0){
			if(y1>H){
				ma[1][H-(y1-H)]=max(ma[1][H-(y1-H)],r2);
			}else ma[0][y1]=max(ma[0][y1],r2);
			if(y2<0){
				ma[0][-y2]=max(ma[0][-y2],r1);
			}else ma[1][y2]=max(ma[1][y2],r1);
		}
	}
	cout<<ans<<endl;
}

signed main(){
	ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
	int T=1;cin>>T;
	while(T--) slove();
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3564kb

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: 444ms
memory: 14884kb

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
2
0
2
4
6
1
2
0
0
1
2
1
1
0
1
0
0
2
1
1
3
2
3
3
2
1
2
0
1
5
1
1
1
0
1
3
1
2
3
3
3
2
1
0
3
1
2
2
0
4
1
1
0
1
2
2
2
1
1
1
1
2
3
2
2
2
1
1
3
1
6.17.8..?1.1.0??1.3.0??2.1.0??2.2.0??2.3.0??2.4.0??3.1.1??3.2.0??3.3.0??5.1.0??5.2.0??5.5.0??6.2.0??6.5.1??7.4.0??7.5.1??8.3.0??8.4.0??9.1.1??9.2.1??9...

result:

wrong output format Expected integer, but "6.17.8..?1.1.0??1.3.0??2.1.0??...9.4.1??10.3.0??10.4.1??10.5.1?0" found