QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740363#9156. 百万富翁piggy123Compile Error//C++20502b2024-11-13 09:22:372024-11-13 09:22:37

Judging History

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

  • [2024-11-13 09:22:37]
  • 评测
  • [2024-11-13 09:22:37]
  • 提交

answer

#include "richest.h"
#define ll long long

int richest(int N, int T, int S) {
	if (T==1){
		vector<ll> vct1,vct2;
		for (ll i=0;i<N;i++){
			for (ll j=i+1;j<N;j++){
				vct1.push_back(i);
				vct2.push_back(j);
			}
		}
		vector<ll> p=ask(vct1,vct2);
		for (ll i=0;i<N;i++){
			ll c=0;
			for (ll j=0;j<N;j++){
				if (i!=j){
					if (j<i){
						c+=p[j*N+i]==i;
					}else{
						c+=p[i*N+j]==i;
					}
				}
			}
			if (c==N-1){
				return i;
			}
		}
	}
    return 1;
}

Details

answer.code: In function ‘int richest(int, int, int)’:
answer.code:6:17: error: ‘vector’ was not declared in this scope
    6 |                 vector<ll> vct1,vct2;
      |                 ^~~~~~
answer.code:6:17: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from richest.h:4,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_vector.h:425:11: note:   ‘std::vector’
  425 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   ‘std::pmr::vector’
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
answer.code:2:12: error: expected primary-expression before ‘long’
    2 | #define ll long long
      |            ^~~~
answer.code:6:24: note: in expansion of macro ‘ll’
    6 |                 vector<ll> vct1,vct2;
      |                        ^~
answer.code:9:33: error: ‘vct1’ was not declared in this scope
    9 |                                 vct1.push_back(i);
      |                                 ^~~~
answer.code:10:33: error: ‘vct2’ was not declared in this scope
   10 |                                 vct2.push_back(j);
      |                                 ^~~~
answer.code:2:12: error: expected primary-expression before ‘long’
    2 | #define ll long long
      |            ^~~~
answer.code:13:24: note: in expansion of macro ‘ll’
   13 |                 vector<ll> p=ask(vct1,vct2);
      |                        ^~
answer.code:19:52: error: ‘p’ was not declared in this scope
   19 |                                                 c+=p[j*N+i]==i;
      |                                                    ^
answer.code:21:52: error: ‘p’ was not declared in this scope
   21 |                                                 c+=p[i*N+j]==i;
      |                                                    ^