QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#313911#7730. Convex CheckerHqwqCompile Error//C++141.7kb2024-01-25 10:00:502024-01-25 10:00:50

Judging History

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

  • [2024-07-04 19:27:17]
  • hack成功,自动添加数据
  • (/hack/727)
  • [2024-07-04 19:17:30]
  • hack成功,自动添加数据
  • (/hack/726)
  • [2024-01-25 10:00:50]
  • 评测
  • [2024-01-25 10:00:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int n,cnt=0;
struct point{
    int x,y;
}p[200010],v[200010],q[200010];

bool cmp(point x,point y){
    if (x.x!=y.x) return x.x<y.x;
    return x.y<y.y;
}

bool check(point x,point y,point z){
    int a,b,c,d;
    a=y.x-x.x;
    b=y.y-x.y;
    c=z.x-y.x;
    d=z.y-y.y;
    if (a*d-b*c>0) return 1;
    return 0;
}

void tb(){
    v[++cnt]=p[1];
    v[++cnt]=p[2];
    for (int i=3;i<=n;i++){
        while(!check(v[cnt-1],v[cnt],p[i]) && cnt>1){
            cnt--;
        }
        v[++cnt]=p[i];
    }
    int temp=cnt;
    v[++cnt]=p[n-1];
    for (int i=n-2;i>=1;i--){
        while(!check(v[cnt-1],v[cnt],p[i]) && cnt>temp){
            cnt--;
        }
        v[++cnt]=p[i];
    }
    cnt--; 
}

int main(){
    scanf("%d",&n);
    for (int i=1;i<=n;i++){
        int x,y;
        scanf("%d %d",&p[i].x,&p[i].y);
        q[i]=p[i];
    }
    sort(q+1,q+1+n,cmp);
    tb();
    int pp=1;
    for (int i=2;i<=q;i++){
    	if (q[i]==q[i-1]) pp=0;
	}
    if (cnt!=n) pp=0;
//    else {
//	    int p1=1,p2=1;
//    	int i=1,j;
//	    for (i=1;i<=n;i++) if (q[1].x==v[i].x && q[1].y==v[i].y) break;
//	    j=1;
//	    while(j<=n){
//	    	if (v[i].x!=q[j].x || v[i].y!=q[j].y){
//	    		p1=0;
//	    		break;
//			}
//	    	i=i%n+1;
//			j=j+1;
//		}
//		for (i=1;i<=n;i++) if (q[1].x==v[i].x && q[1].y==v[i].y) break;
//		j=1;
//		while(j<=n){
//			if (v[i].x!=q[j].x || v[i].y!=q[j].y){
//	    		p2=0;
//	    		break;
//			}
//	    	i=i-1;
//	    	if (i<=0) i+=n; 
//			j=j+1;
//		}
//		pp=p1|p2;
//	}
    if (pp) printf("Yes\n");
    else printf("No\n");
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:54:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   54 |     for (int i=2;i<=q;i++){
      |                  ~^~~
answer.code:55:17: error: no match for ‘operator==’ (operand types are ‘point’ and ‘point’)
   55 |         if (q[i]==q[i-1]) pp=0;
      |             ~~~~^~~~~~~~
      |                |       |
      |                point   point
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:1:
/usr/include/c++/13/bits/regex.h:1103:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)’
 1103 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1103:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:1199:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)’
 1199 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1199:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:1274:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’
 1274 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1274:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:1366:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)’
 1366 |     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1366:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:1441:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’
 1441 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1441:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:1534:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)’
 1534 |     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1534:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:1613:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’
 1613 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1613:5: note:   template argument deduction/substitution failed:
answer.code:55:24: note:   ‘point’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |         if (q[i]==q[i-1]) pp=0;
      |                        ^
/usr/include/c++/13/bits/regex.h:2186:5: note: candidate: ‘template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)’
 2186 |     operator==(const match_results<_Bi_iter, _Alloc>& __m1,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:2186:5: note:   template argument deduction/substitution failed:
answer.code:55:24...