QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#490689 | #9156. 百万富翁 | Eternatis | 15 | 627ms | 27736kb | C++14 | 4.4kb | 2024-07-25 16:06:33 | 2024-07-25 16:06:36 |
Judging History
answer
//¸¡ÓÎÖ®ÈË Ò²ÕõÔú²»ÒÑÖ´×Å´æÔÚÏÂÈ¥
#include<bits/stdc++.h>
//#include "richest.h"
using namespace std;
#define NN 1000010
#define db long double
#define pii pair<int,int>
#define st first
#define ed second
#define mkp make_pair
#define pb push_back
#define eps 1e-9
#define mod 998244353
#define mod2 1000000007
#define bs 13131
#define bs2 131
#define INF 0x3f3f3f3f3f3f3f3f
#define il inline
#define vi vector<int>
#define ins insert
#define umap unordered_map
#define uset unordered_set
#define R(x) x.begin(),x.end()
#define B(x) x.begin()
#define E(x) x.end()
#define lb lower_bound
#define ub upper_bound
#define vi vector<int>
il int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x*f;
}
int n,m,q,k;
bool cmp[1010][1010];
vi ask(vi a,vi b);
il int solve1(){
vi a,b;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++)
cmp[i][j]=cmp[j][i]=0,a.pb(i),b.pb(j);
vi op=ask(a,b);
int p=0;
for(int i=0;i<op.size();i++){
// printf("%lld %lld %lld\n",a[i],b[i],op[i]);
int A=a[i],B=b[i];
if(op[i]==A)cmp[A][B]=1;
else cmp[B][A]=1;
}
for(int i=0;i<n;i++){
int fl=1;
for(int j=0;j<n;j++){
if(i!=j&&cmp[i][j]==0){
fl=0;
break;
}
}
if(fl)return i;
}
return p;
}
int richest(int nn,int ttt,int sss){
n=nn;
if(n<=1000)return solve1();
}
//signed main(){
// T=read();
// while(T--)solve();
// return 0;
//}
/*
static int N, T, S, r, t, s;
static vector<int> W;
vector<int> ask(vector<int> i, vector<int> j) {
++t;
if (t > T)
throw string("Too many queries");
if (i.size() != j.size())
throw string("Invalid query: i and j must have the same size");
int m = i.size();
s += m;
if (s > S)
throw string("Too many total elements in queries");
vector<int> res(m);
for (int k = 0; k < m; k++) {
if (i[k] < 0 || i[k] >= N || j[k] < 0 || j[k] >= N)
throw string("Invalid query: index out of bounds");
res[k] = W[i[k]] > W[j[k]] ? i[k] : j[k];
}
return res;
}
constexpr int Sub2_score = 85;
int main() {
int R;
cin >> N >> T >> S >> R;
if (N <= 0 || T < 0 || S < 0 || R < 0) {
cerr << "Invalid input for N, T, S or R" << endl;
return 1;
}
mt19937_64 rng(R);
W.resize(N);
bool hasWrong = false;
int maxt = 0, maxs = 0;
for (int _ = 0; _ < 10; _++) {
iota(W.begin(), W.end(), 0);
shuffle(W.begin(), W.end(), rng);
int answer = max_element(W.begin(), W.end()) - W.begin();
try {
r = -1; t = 0; s = 0;
r = richest(N, T, S);
// for(int i=0;i<N;i++)cout << W[i] << " ";
// puts("");
cout << r << endl;
if (r != answer)
throw string("Wrong Answer");
cout << r << ' ' << t << ' ' << s << " Correct (pretest)" << endl;
} catch (const string& msg) {
hasWrong = true;
cout << r << ' ' << t << ' ' << s << ' ' << msg << endl;
}
maxt = max(maxt, t);
maxs = max(maxs, s);
}
if (N == 1000 && T == 1 && S == 499500) {
if (hasWrong) {
cout << "Wrong Case 1, score: 0 / " << (100 - Sub2_score) << endl;
} else {
cout << "Correct (pretest) Case 1, score: " << (100 - Sub2_score) << " / " << (100 - Sub2_score) << endl;
}
} else if (N == 1000000 && T == 20 && S == 2000000) {
if (hasWrong) {
cout << "Wrong Case 2, score: 0 / " << Sub2_score << endl;
} else {
double ft = 1;
if (maxt > 8)
ft -= sqrt(maxt - 8) / 4;
double gs = 1;
if (maxs > 1099944) {
if (maxs < 1100044)
gs -= log10(maxs - 1099943) / 6;
else
gs -= 1.0 / 3 + pow(maxs - 1100043, 1.0 / 2) / 1500;
}
cout
<< (ft * gs >= 1 ? "Correct" : "Partially correct")
<< " (pretest) Case 2, score: "
<< to_string(int(Sub2_score * ft * gs))
<< " / " << Sub2_score;
}
} else {
if (hasWrong) {
cout << "Wrong" << endl;
} else {
cout << "Correct" << endl;
}
}
}
*/
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 614ms
memory: 27624kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Runtime Error
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 15
Accepted
time: 627ms
memory: 27736kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Runtime Error
input:
1000000 20 2000000 29091471
output:
Unauthorized output