QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#509851 | #9156. 百万富翁 | ewrilan# | 68.99999 | 2053ms | 85352kb | C++20 | 3.5kb | 2024-08-08 19:15:06 | 2024-08-08 19:15:06 |
Judging History
answer
//
#ifndef __SIZEOF_INT128__
#define __SIZEOF_INT128__
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define rep(i, p, k) for(int i(p); i < (k); ++i)
#define per(i, p, k) for(int i(p); i > (k); --i)
#define sz(x) (int)(x).size()
#define sc static_cast
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef __int128_t lll;
//#define int ll
template <typename T = int> using par = std::pair <T, T>;
#define fi first
#define se second
#define test int _number_of_tests(in()); while(_number_of_tests--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb emplace_back
struct Timer {
string name{""};
time_point<high_resolution_clock> end, start{high_resolution_clock::now()};
duration<float, std::milli> dur;
Timer() = default;
Timer(string nm): name(nm) {}
~Timer() {
end = high_resolution_clock::now(); dur= end - start;
cout << "@" << name << "> " << dur.count() << " ms" << '\n';
}
};
template <typename T = int> inline T in()
{
static T x;
std::cin >> x;
return x;
}
std::string yn(bool b)
{
if(b) return "YES\n";
else return "NO\n";
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par);
template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector <T>& wek)
{
for(const auto& i : wek)out << i << ' ';
return out;
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par)
{
out << '{'<<par.first<<", "<<par.second<<"}";
return out;
}
#define show(x) cerr << #x << " = " << x << '\n';
#include "richest.h"
int richest(int n, int t ,int s)
{
vector <int> v(n);
iota(all(v), 0);
// mt19937 tw(2137);
// shuffle(all(v), tw);
rep(powt, 0, 4)if(t > 1 && sz(v) > 1){
vector <int> a, b;
for(int i(sz(v) % 2); i < sz(v); i += 2){
a.pb(v[i]); b.pb(v[i+1]);
// if(cs % int(1e4) == 0)cerr << 'A' << cs << '\n';
}
vector <int> o(ask(a, b));
if(sz(v) % 2)o.pb(v[0]);
v = o;
--t;
// cerr << "---------------------------\n";
}
rep(powt, 0, 5)if(t > 1 && sz(v) > 1){
vector <int> a, b;
for(int i(sz(v) % 3); i < sz(v); i += 3){
a.pb(v[i]); b.pb(v[i+1]);
a.pb(v[i]); b.pb(v[i+2]);
a.pb(v[i+1]); b.pb(v[i+2]);
// if(cs % int(1e4) == 0)cerr << 'B' << cs << '\n';
}
vector <int> o(ask(a, b));
v.resize(sz(v) % 3);
rep(i, 0, sz(o)/3){
if(o[3*i] == o[3*i+1])v.pb(o[3*i]);
else if(o[3*i] == o[3*i+2])v.pb(o[3*i]);
else if(o[3*i+1] == o[3*i+2])v.pb(o[3*i+1]);
}
--t;
// cerr << "---------------------------\n";
}
if(sz(v) == 1)return v[0];
vector <int> a, b;
rep(i, 0, sz(v))rep(j, i+1, sz(v)){
a.pb(v[i]);
b.pb(v[j]);
// if(cs % int(1e4) == 0)cerr << 'C' << cs << '\n';
}
vector <int> o(ask(a, b));
vector <int> l(n);
for(auto i: o)++l[i];
rep(i, 0, n)if(l[i] == sz(v)-1)return i;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 602ms
memory: 22056kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 54
Acceptable Answer
time: 2053ms
memory: 85352kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1064016 7601495472103762793 0.635294 4439523384460221017
result:
points 0.635294 Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1064016
Final Tests
Test #1:
score: 15
Accepted
time: 611ms
memory: 23136kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 54
Acceptable Answer
time: 2038ms
memory: 85344kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1064016 7601495472103762793 0.635294 4439523384460221017
result:
points 0.635294 Partially correct Case 2, 54 / 85, maxt = 10, maxs = 1064016