QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#490204 | #9156. 百万富翁 | Snowfall1462# | 15 | 624ms | 79700kb | C++14 | 1.2kb | 2024-07-25 12:45:03 | 2024-07-25 12:45:03 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int richest(int N, int T, int S)
{
if (N <= 1000)
{
vector<int> A, B, C;
for (int i = 1; i < N; i++)
{
for (int j = 0; j < i; j++)
A.emplace_back(i), B.emplace_back(j);
}
int fa[1010];
memset(fa, 0, sizeof(fa));
C = ask(A, B);
for (int i = 0; i < A.size(); i++)
{
int x = A[i], y = B[i], z = C[i];
if (z == x)
fa[y] = x;
else
fa[x] = y;
}
for (int i = 0; i < N; i++)
{
if (!fa[i])
return i;
}
}
else
{
vector<int> A;
for (int i = 0; i < N; i++)
A.emplace_back(i);
while (A.size() >= 2)
{
int n = A.size();
vector<int> QA, QB, Ans;
for (int i = 0; i + 1 < N; i += 2)
QA.emplace_back(i), QB.emplace_back(i + 1);
Ans = ask(QA, QB);
if (n & 1)
Ans.emplace_back(A[n - 1]);
A = Ans;
}
return A[0];
}
return 1;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 624ms
memory: 23032kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Wrong Answer
time: 127ms
memory: 79700kb
input:
1000000 20 2000000 29091473
output:
Too many total elements in queries 1469670942222006797 0.000000 6906350380861515327
result:
points 0.0 Too many total elements in queries
Final Tests
Test #1:
score: 15
Accepted
time: 606ms
memory: 22936kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Wrong Answer
time: 131ms
memory: 79604kb
input:
1000000 20 2000000 29091471
output:
Too many total elements in queries 1469670942222006797 0.000000 6906350380861515327
result:
points 0.0 Too many total elements in queries