提供的测试用例是正确的,但提交却是零分,求帮助,不知为啥?
参考链接(侵删):https://blog.csdn.net/weixin_42449444/article/details/107819476
代码如下:
#include<iostream>
using namespace std;
struct point{
int x, y;
char type;
};
struct line{
int x, y, z;
};
int result(point p, line l){
return l.z + l.x*p.x + l.y*p.y;
}
point p[1003];
line l[23];
int main(){
int N = 0, M = 0;
cin >> N >> M;
for(int k = 0; k < N; k++){
cin >> p[k].x >> p[k].y >> p[k].type;
}
for(int i =0; i < M; i++){
cin >> l[i].z >> l[i].x >> l[i].y;
}
int tempA = 0, tempB = 0;
bool isA = true, isB = true;
for(int i =0; i < M; i++){
tempA = 0, tempB = 0;
isA = true, isB = true;
for(int k = 0; k < N; k++){
if(p[k].type == 'A') tempA = result(p[k],l[i]);
if(p[k].type == 'B') tempB = result(p[k],l[i]);
}
for(int k = 0; k < N; k++){
if(p[k].type == 'A'){
isA *= (tempA*result(p[k],l[i]) > 0);
}
if(p[k].type == 'B'){
isB *= (tempB*result(p[k],l[i]) > 0);
}
}
if(isA && isB && tempA*tempB < 0) cout << "Yes" << endl;
else cout << "No" << endl;
}
return 0;
}
测试用例
9 3
1 1 A
1 0 A
1 -1 A
2 2 B
2 3 B
0 1 A
3 1 B
1 3 B
2 0 A
0 2 -3
-3 0 2
-3 1 1
结果如下:
No
No
Yes