QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#509984 | #9156. 百万富翁 | AdamGS# | 15 | 607ms | 83540kb | C++23 | 1.2kb | 2024-08-08 20:21:12 | 2024-08-08 20:21:13 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int INF=1e9+7;
int solve1(int n) {
vector<int>A, B;
rep(i, n) rep(j, i) {
A.pb(j); B.pb(i);
}
vector<int>C=ask(A, B);
vector<int>ile(n);
for(auto i : C) ++ile[i];
int ans=-1;
rep(i, n) if(ile[i]==n-1) ans=i;
return ans;
}
int richest(int n, int t, int s) {
if(t==1) return solve1(n);
vector<pair<int,int>>pyt={{2, INF}, {2, INF}, {2, INF}, {2, INF}, {3, INF}, {6, INF}, {18, 4}, {183, 1}};
vector<int>T(n);
rep(i, n) T[i]=i;
for(auto i : pyt) {
vector<int>A, B;
int akt=0;
for(int j=0; j<T.size(); j+=i.st) {
int l=min((int)T.size(), j+i.st)-j;
rep(a, l) rep(b, a) {
A.pb(T[j+a]);
B.pb(T[j+b]);
}
++akt;
if(akt==i.nd) ++i.st;
}
if(akt>=i.nd) --i.st;
akt=0;
vector<int>C=ask(A, B);
vector<int>ile(n);
for(auto j : C) ++ile[j];
vector<int>D;
for(int j=0; j<T.size(); j+=i.st) {
int l=min((int)T.size(), j+i.st)-j;
rep(a, l) if(ile[T[j+a]]==l-1) D.pb(T[j+a]);
++akt;
if(akt==i.nd) ++i.st;
}
T=D;
}
return T[0];
}
詳細信息
Pretests
Pretest #1:
score: 15
Accepted
time: 603ms
memory: 22920kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Wrong Answer
time: 199ms
memory: 83540kb
input:
1000000 20 2000000 29091473
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Final Tests
Test #1:
score: 15
Accepted
time: 607ms
memory: 22364kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Wrong Answer
time: 194ms
memory: 83428kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer