QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535573#9156. 百万富翁lyx123886a123886#26.00002 3161ms100324kbC++141.6kb2024-08-28 10:29:582024-08-28 10:29:59

Judging History

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

  • [2024-08-28 10:29:59]
  • 评测
  • 测评结果:26.00002
  • 用时:3161ms
  • 内存:100324kb
  • [2024-08-28 10:29:58]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pi pair<int,int> 
#define vp vector<pi> 
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define pb push_back
namespace solution {
    int N,T,S;
    const int MAXN=1e6+50;
    vi V;//node_set
    namespace Query {
        bool ban[MAXN];
        vi qry(vp e) {
            vi result;
            for(int u:V) ban[u]=false;
            vi a,b;
            for(auto i:e) a.pb(i.first),b.pb(i.second);
            vi c=ask(a,b);
            for(int i=0;i<e.size();++i) {
                ban[a[i]^b[i]^c[i]]=true;
            }
            for(int u:V) if(!ban[u]) result.pb(u);
            return result;
        }
    };using Query::qry;
    
    namespace sub1 {
        int sol() {
            vp e;rep(i,0,N-1) rep(j,0,i-1) e.pb({i,j});
            vi ans=qry(e);
            assert(ans.size()==1);
            return ans.back();
        }
        bool check() {return N==1000;}
    };

    namespace pipei {
        int sol() {
            while(V.size()>1) {
                vp e;
                for(int i=0;i+1<V.size();i+=2) e.pb({V[i],V[i+1]});
                V=qry(e);
            }
            return V[0];
        }
    };

    int solve() {
        V.resize(N);rep(i,0,N-1) V[i]=i;
        if(sub1::check()) return sub1::sol();
        return pipei::sol();

        return -1;//failed
    }
};
#undef rep
#undef vi
#undef pi
#undef vp
#undef pb 
int richest(int N, int T, int S) {
    solution::N=N,solution::T=T,solution::S=S;
    return solution::solve() ;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 660ms
memory: 29284kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 11
Acceptable Answer
time: 3156ms
memory: 100192kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
1811468636458994965
0.129412
3823502568050958645

result:

points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999


Final Tests

Test #1:

score: 15
Accepted
time: 661ms
memory: 29132kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 11
Acceptable Answer
time: 3161ms
memory: 100324kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
1811468636458994965
0.129412
3823502568050958645

result:

points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999