QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490277#9156. 百万富翁CoffinsCompile Error//C++145.4kb2024-07-25 13:58:182024-07-25 13:58:18

Judging History

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

  • [2024-07-25 13:58:18]
  • 评测
  • [2024-07-25 13:58:18]
  • 提交

answer

/*#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
int w[N],ct=0,cs=0;
mt19937 rnd(time(0));
vector<int> ask(vector<int> a,vector<int> b)
{
    int sz=a.size();ct++;cs+=sz;
    vector<int> c;
    for(int i=0;i<sz;i++)
    {
        if(w[a[i]]>w[b[i]])c.push_back(a[i]);
        else c.push_back(b[i]);
    }return c;
}*/
#include "richest.h"
using ll=long long;
const ll inf=1e18+7;
int gt(vector<int> vc)
{
    int sz=vc.size();
    static bool vis[1000005];
    for(int i=0;i<sz;i++)vis[i]=0;
    vector<int> a,b;int ct=0;
    for(int i=0;i<sz;i++)for(int j=i+1;j<sz;j++)
    a.push_back(vc[i]),b.push_back(vc[j]);
    vector<int> c=ask(a,b);
    for(int i=0;i<sz;i++)for(int j=i+1;j<sz;j++)
    {if(c[ct]==vc[i])vis[j]=1;else vis[i]=1;ct++;}
    for(int i=0;i<sz;i++)if(!vis[i])return vc[i];
}
int slv1(int n)
{
    vector<int> vc;
    for(int i=1;i<=n;i++)vc.push_back(i);
    return gt(vc);
}bool cked=0;
//slv1 up | slv2 down
vector<int> gp[65][65];
vector<int> fr[6][65];
ll f[6][65],g[65][65];
vector<int> typ[9];
vector<int> dg[1000005];
int a[4][6]={
{47,47,48,48,48,48},
{47,48,48,48,48,48},
{48,48,48,48,56,56},
{48,48,48,53,54,54},
};
int b[4]={286,287,304,305};
vector<int> sn[N],gr[N];int tot=0;
int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
bool vis[N];
int solve(int L,int R,int t)
{
    int cr=++tot;
    tl[cr]=L,tr[cr]=R,d[cr]=t;
    if(t==1)return cr;
    if(t>=6)
    {
        vector<int> vc;
        int len=R-L+1,l=L,r;
        for(auto c:dg[len])
        {
            r=l+c-1;
            sn[cr].push_back(solve(l,r,t-1));
            l=r+1;
        }assert(l==R+1);
    }
    else
    {
        vector<int> vc;
        int len=R-L+1,l=L,r;
        assert(len<=60);
        for(auto c:fr[t][len])
        {
            r=l+c-1;
            sn[cr].push_back(solve(l,r,t-1));
            l=r+1;
        }assert(l==R+1);
    }
    return cr;
}
void init()
{
    int m=60;
    for(int i=1;i<=m;i++)f[1][i]=1ll*i*(i-1)/2;
    for(int i=1;i<=m;i++)fr[1][i].push_back(1);
    for(int t=2;t<=5;t++)
    {
        for(int i=0;i<=m;i++)for(int j=0;j<=m;j++)
        g[i][j]=inf;g[0][0]=0;gp[0][0].clear();
        for(int i=1;i<=m;i++)
        {
            for(int j=i;j<=m;j++)for(int k=1;k<=m;k++)
            {
                ll val=g[j-i][k-1]+f[t-1][i];
                if(g[j][k]>val)
                {
                    gp[j][k]=gp[j-i][k-1];
                    gp[j][k].push_back(i);
                    g[j][k]=val;
                }
            }
        }
        for(int i=1;i<=m;i++)
        {
            f[t][i]=inf;
            for(int j=1;j<=m;j++)
            {
                if(f[t][i]>f[1][j]+g[i][j])
                {
                    f[t][i]=f[1][j]+g[i][j];
                    fr[t][i]=gp[i][j];
                }
            }
        }
    }
    int v=1e6;
    for(int i=1;i<=195;i++)
    dg[v].push_back(4878);
    for(int i=1;i<=10;i++)
    dg[v].push_back(4879);
    dg[4878].push_back(286);
    for(int i=1;i<=16;i++)
    dg[4878].push_back(287);
    dg[4879].push_back(304);
    for(int i=1;i<=15;i++)
    dg[4879].push_back(305);
    for(int i=0;i<4;i++)
    {
        for(int j=0;j<6;j++)
        dg[b[i]].push_back(a[i][j]);
    }solve(1,1000000,8);
    for(int i=1;i<=tot;i++)
    typ[d[i]].push_back(i);
    cout<<tot<<'\n';
}
int slv2()
{
    if(!cked)init(),cked=1;
    vector<int> va,vb,c;
    for(auto i:typ[1])
    {
        for(int j=tl[i];j<=tr[i];j++)
        for(int k=j+1;k<=tr[i];k++)
        va.push_back(j),vb.push_back(k);
    }c=ask(va,vb);int ct=0;
    for(auto i:typ[1])
    {
        for(int j=tl[i];j<=tr[i];j++)vis[j]=0;
        for(int j=tl[i];j<=tr[i];j++)
        for(int k=j+1;k<=tr[i];k++)
        {
            if(c[ct]==j)vis[k]=1;
            else vis[j]=1;ct++;
        }
        for(int j=tl[i];j<=tr[i];j++)
        if(!vis[j])vl[i]=j;
    }
    for(int x=2;x<=8;x++)
    {
        va.clear(),vb.clear();
        for(auto i:typ[x])
        {
            vector<int> vc;int sz=sn[i].size();
            for(auto v:sn[i])vc.push_back(vl[v]);
            for(int j=0;j<sz;j++)for(int k=j+1;k<sz;k++)
            va.push_back(vc[j]),vb.push_back(vc[k]);
        }c=ask(va,vb);ct=0;
        for(auto i:typ[x])
        {
            vector<int> vc;int sz=sn[i].size();//cout<<sz<<' ';
            for(auto v:sn[i])vc.push_back(vl[v]);
            for(int j=0;j<sz;j++)vis[j]=0;
            for(int j=0;j<sz;j++)
            for(int k=j+1;k<sz;k++)
            {
                if(c[ct]==vc[j])vis[k]=1;
                else vis[j]=1;ct++;
            }
            for(int j=0;j<sz;j++)
            if(!vis[j])vl[i]=vc[j];
            int ps=0;
        }//cout<<'\n';
    }return vl[1];
}
int richest(int n,int t,int s)
{
    if(t==1)return slv1(n);
    else return slv2();
}/*
void work()
{
    for(int T=1;T<=10;T++)
    {
        for(int i=1;i<=1000000;i++)w[i]=i;
        for(int i=1;i<=1000000;i++)
        {
            int x=rnd()%1000000+1,y=rnd()%1000000+1;
            swap(w[x],w[y]);
        }ct=0,cs=0;cout<<"# "<<T<<" : ";
        if(w[richest(1000000,8,2000000)]==1000000)
        {
            cout<<ct<<' '<<cs<<' '<<"AC qwq\n";
        }
        else
        {
            cout<<ct<<' '<<cs<<' '<<"WA!!!\n";
        }
    }
}
int main()
{
    work();
    return 0;
}*/

Details

answer.code:20:8: error: ‘vector’ was not declared in this scope; did you mean ‘std::vector’?
   20 | int gt(vector<int> vc)
      |        ^~~~~~
      |        std::vector
In file included from /usr/include/c++/13/vector:66,
                 from richest.h:4,
                 from answer.code:17:
/usr/include/c++/13/bits/stl_vector.h:425:11: note: ‘std::vector’ declared here
  425 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
answer.code:20:15: error: expected primary-expression before ‘int’
   20 | int gt(vector<int> vc)
      |               ^~~
answer.code: In function ‘int slv1(int)’:
answer.code:35:5: error: ‘vector’ was not declared in this scope; did you mean ‘std::vector’?
   35 |     vector<int> vc;
      |     ^~~~~~
      |     std::vector
/usr/include/c++/13/bits/stl_vector.h:425:11: note: ‘std::vector’ declared here
  425 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
answer.code:35:12: error: expected primary-expression before ‘int’
   35 |     vector<int> vc;
      |            ^~~
answer.code:36:26: error: ‘vc’ was not declared in this scope
   36 |     for(int i=1;i<=n;i++)vc.push_back(i);
      |                          ^~
answer.code:37:15: error: ‘vc’ was not declared in this scope
   37 |     return gt(vc);
      |               ^~
answer.code:37:17: error: ‘gt’ cannot be used as a function
   37 |     return gt(vc);
      |                 ^
answer.code: At global scope:
answer.code:40:1: error: ‘vector’ does not name a type
   40 | vector<int> gp[65][65];
      | ^~~~~~
answer.code:41:1: error: ‘vector’ does not name a type
   41 | vector<int> fr[6][65];
      | ^~~~~~
answer.code:43:1: error: ‘vector’ does not name a type
   43 | vector<int> typ[9];
      | ^~~~~~
answer.code:44:1: error: ‘vector’ does not name a type
   44 | vector<int> dg[1000005];
      | ^~~~~~
answer.code:52:1: error: ‘vector’ does not name a type
   52 | vector<int> sn[N],gr[N];int tot=0;
      | ^~~~~~
answer.code:53:8: error: ‘N’ was not declared in this scope
   53 | int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
      |        ^
answer.code:53:14: error: ‘N’ was not declared in this scope
   53 | int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
      |              ^
answer.code:53:19: error: ‘N’ was not declared in this scope
   53 | int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
      |                   ^
answer.code:53:25: error: ‘N’ was not declared in this scope
   53 | int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
      |                         ^
answer.code:53:31: error: ‘N’ was not declared in this scope
   53 | int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
      |                               ^
answer.code:53:37: error: ‘N’ was not declared in this scope
   53 | int tl[N],tr[N],d[N],vl[N],ql[N],qr[N];
      |                                     ^
answer.code:54:10: error: ‘N’ was not declared in this scope
   54 | bool vis[N];
      |          ^
answer.code: In function ‘int solve(int, int, int)’:
answer.code:58:5: error: ‘tl’ was not declared in this scope; did you mean ‘t’?
   58 |     tl[cr]=L,tr[cr]=R,d[cr]=t;
      |     ^~
      |     t
answer.code:58:14: error: ‘tr’ was not declared in this scope; did you mean ‘cr’?
   58 |     tl[cr]=L,tr[cr]=R,d[cr]=t;
      |              ^~
      |              cr
answer.code:58:23: error: ‘d’ was not declared in this scope
   58 |     tl[cr]=L,tr[cr]=R,d[cr]=t;
      |                       ^
answer.code:62:9: error: ‘vector’ was not declared in this scope; did you mean ‘std::vector’?
   62 |         vector<int> vc;
      |         ^~~~~~
      |         std::vector
/usr/include/c++/13/bits/stl_vector.h:425:11: note: ‘std::vector’ declared here
  425 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
answer.code:62:16: error: expected primary-expression before ‘int’
   62 |         vector<int> vc;
      |                ^~~
answer.code:64:20: error: ‘dg’ was not declared in this scope; did you mean ‘g’?
   64 |         for(auto c:dg[len])
      |                    ^~
      |                    g
answer.code:67:13: error: ‘sn’ was not declared in this scope
   67 |             sn[cr].push_back(solve(l,r,t-1));
      |             ^~
answer.code:69:10: error: ‘assert’ was not declared in this scope
   69 |         }assert(l==R+1);
      |          ^~~~~~
answer.code:18:1: note: ‘assert’ is defined in header ‘<cassert>’; did you forget to ‘#include <cassert>’?
   17 | #include "richest.h"
  +++ |+#include <cassert>
   18 | using ll=long long;
answer.code:73:9: error: ‘vector’ was not declared in this scope; did you mean ‘std::vector’?
   73 |         vector<int> vc;
      |         ^~~~~~
      |         std::vector
/usr/include/c++/13/bits/stl_vector.h:425:11: note: ‘std::vector’ declared here
  425 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
answer.code:73:16: error: expected primary-expression before ‘int’
   73 |         vector<int> vc;
     ...