QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#509962#9156. 百万富翁Rafi22#26.00002 2314ms97804kbC++141.7kb2024-08-08 20:10:582024-08-08 20:10:58

Judging History

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

  • [2024-08-08 20:10:58]
  • 评测
  • 测评结果:26.00002
  • 用时:2314ms
  • 内存:97804kb
  • [2024-08-08 20:10:58]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;

int richest(int n,int T,int S)
{
    if(n==1000)
    {
        vector<int>is(n,1);
        vector<int>A,B;
        FOR(i,0,n-1)
        {
            FOR(j,i+1,n-1)
            {
                A.pb(i);
                B.pb(j);
            }
        }
        vector<int>W=ask(A,B);
        int it=0;
        FOR(i,0,n-1)
        {
            FOR(j,i+1,n-1)
            {
                if(W[it]!=i) is[i]=0;
                if(W[it]!=j) is[j]=0;
                it++;
            }
        }
        FOR(i,0,n-1) if(is[i]) return i;
    }
    vector<int>V(n);
    FOR(i,0,n-1) V[i]=i;
    while(sz(V)>1)
    {
        vector<int>A,B;
        for(int i=0;i+1<sz(V);i+=2)
        {
            A.pb(V[i]);
            B.pb(V[i+1]);
        }
        vector<int>nV=ask(A,B);
        if(sz(V)%2==1) nV.pb(V.back());
        V=nV;
    }
    return V[0];
}




















详细


Pretests

Pretest #1:

score: 15
Accepted
time: 629ms
memory: 21896kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 11
Acceptable Answer
time: 2314ms
memory: 93896kb

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: 627ms
memory: 23108kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 11
Acceptable Answer
time: 2308ms
memory: 97804kb

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