QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#740708 | #9156. 百万富翁 | piggy123 | Compile Error | / | / | C++20 | 1.6kb | 2024-11-13 11:12:29 | 2024-11-13 11:12:31 |
Judging History
answer
#include "richest.h"
#define ll long long
ll id[1005][1005],id2[1000005],ls[10]={500000,250000,125000,62500,20833,3472,183,1};
int richest(int N, int T, int S) {
if (T==1){
vector<int> vct1,vct2;
ll tot=-1;
for (ll i=0;i<N;i++){
for (ll j=i+1;j<N;j++){
vct1.push_back(i);
vct2.push_back(j);
id[i][j]=++tot;
}
}
vector<int> 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[id[j][i]]==i;
}else{
c+=p[id[i][j]]==i;
}
}
}
if (c==N-1){
return i;
}
}
}
for (ll i=0;i<=N;i++)id2[i]=0;
vector<int> all;
for (ll i=0;i<N;i++)all.push_back(i);
for (ll i=0;i<8;i++){
ll tot=all.size();
vector<vector<int>> vct;
vct.resize(ls[i]+1);
ll ps=0;
for (ll j=0;j<tot;j++){
vct[ps].push_back(all[j]);ps++;ps%=ls[i];
}
vector<int> p1,p2;
for (ll j=0;j<ls[i];j++){
for (ll k=0;k<vct[j].size();k++){
for (ll l=k+1;l<vct[j].size();l++){
p1.push_back(vct[j][k]);p2.push_back(vct[j][l]);
}
}
}
vector<int> p3=ask(p1,p2),p4;
ll rk=-1;
for (ll j=0;j<ls[i];j++){
ll tot2=-1;
for (ll k=0;k<vct[j].size();k++)id2[vct[j][k]]=++tot2;
vector<int> cnt;
cnt.resize(tot2+2);
for (ll k=0;k<vct[j].size();k++){
for (ll l=k+1;l<vct[j].size();l++){
++rk;
assert(rk<p3.size());
cnt[id2[p3[rk]]]++;
}
}
for (ll k=0;k<vct[j].size();k++)if (cnt[id2[vct[j][k]]]==vct[j].size()-1)p4.push_back(vct[j][k]);
}
all=p4;
}
return all[0];
}
Details
answer.code: In function ‘int richest(int, int, int)’: answer.code:8:17: error: ‘vector’ was not declared in this scope 8 | vector<int> vct1,vct2; | ^~~~~~ answer.code:8: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:8:24: error: expected primary-expression before ‘int’ 8 | vector<int> vct1,vct2; | ^~~ answer.code:12:33: error: ‘vct1’ was not declared in this scope 12 | vct1.push_back(i); | ^~~~ answer.code:13:33: error: ‘vct2’ was not declared in this scope 13 | vct2.push_back(j); | ^~~~ answer.code:17:24: error: expected primary-expression before ‘int’ 17 | vector<int> p=ask(vct1,vct2); | ^~~ answer.code:23:52: error: ‘p’ was not declared in this scope 23 | c+=p[id[j][i]]==i; | ^ answer.code:25:52: error: ‘p’ was not declared in this scope 25 | c+=p[id[i][j]]==i; | ^ answer.code:35:9: error: ‘vector’ was not declared in this scope 35 | vector<int> all; | ^~~~~~ answer.code:35:9: note: suggested alternatives: /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:35:16: error: expected primary-expression before ‘int’ 35 | vector<int> all; | ^~~ answer.code:36:29: error: ‘all’ was not declared in this scope; did you mean ‘ll’? 36 | for (ll i=0;i<N;i++)all.push_back(i); | ^~~ | ll answer.code:38:24: error: ‘all’ was not declared in this scope; did you mean ‘ll’? 38 | ll tot=all.size(); | ^~~ | ll answer.code:39:31: error: expected primary-expression before ‘int’ 39 | vector<vector<int>> vct; | ^~~ answer.code:40:17: error: ‘vct’ was not declared in this scope 40 | vct.resize(ls[i]+1); | ^~~ answer.code:45:24: error: expected primary-expression before ‘int’ 45 | vector<int> p1,p2; | ^~~ answer.code:49:41: error: ‘p1’ was not declared in this scope; did you mean ‘ps’? 49 | p1.push_back(vct[j][k]);p2.push_back(vct[j][l]); | ^~ | ps answer.code:49:65: error: ‘p2’ was not declared in this scope; did you mean ‘ps’? 49 | p1.push_back(vct[j][k]);p2.push_back(vct[j][l]); | ^~ | ps answer.code:54:24: error: expected primary-expression before ‘int’ 54 | vector<int> p3=ask(p1,p2),p4; | ^~~ answer.code:60:32: error: expected primary-expression before ‘int’ 60 | vector<int> cnt; | ^~~ answer.code:61:25: error: ‘cnt’ was not declared in this scope; did you mean ‘int’? 61 | cnt.resize(tot2+2); | ^~~ | int answer.code:65:51: error: ‘p3’ was not declared in this scope; did you mean ‘ps’? 65 | assert(rk<p3.size()); | ^~ | ps answer.code:65:41: error: ‘assert’ was not declared in this scope 65 | assert(rk<p3.size()); | ^~~~~~ answer.code:2:1: note: ‘assert’ is defined in header ‘<cassert>’; did you forget to ‘#include <cassert>’? 1 | #include "richest.h" +++ |+#include <cassert> 2 | #define ll long long answer.code:69:98: err...