QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#505091 | #9156. 百万富翁 | JCY_ | 15 | 631ms | 58384kb | C++17 | 1.2kb | 2024-08-04 19:44:41 | 2024-08-04 19:44:41 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i128 = __int128;
using u128 = unsigned __int128;
template <typename T>
void chkmax(T &x, const T &y) {
x = max(x, y);
}
template <typename T>
void chkmin(T &x, const T &y) {
x = min(x, y);
}
int brute(const vector<int> &vec) {
vector<int> a, b;
for (int i = 0; i < (int)vec.size(); ++i) {
for (int j = i + 1; j < (int)vec.size(); ++j) {
a.emplace_back(vec[i]);
b.emplace_back(vec[j]);
}
}
vector<int> c = ask(a, b), win(vec.size());
for (int i = 0, t = 0; i < (int)vec.size(); ++i) {
for (int j = i + 1; j < (int)vec.size(); ++j) {
if (c[t++] == vec[i]) {
++win[i];
} else {
++win[j];
}
}
}
return vec[max_element(win.begin(), win.end()) - win.begin()];
}
int richest(int n, int, int) {
if (n == 1000) {
vector<int> vec(n);
iota(vec.begin(), vec.end(), 0);
return brute(vec);
}
}
/*
g++ B.cpp grader.cpp -o B -std=c++17 -O2 -Wall -Wextra -Wshadow -g -fsanitize=address,undefined
*/
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 631ms
memory: 21848kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Wrong Answer
time: 79ms
memory: 58364kb
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: 614ms
memory: 23176kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Wrong Answer
time: 85ms
memory: 58384kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer