QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#468882 | #5481. Beast Bullies | Eiad_Ahmed# | WA | 65ms | 11008kb | C++20 | 3.9kb | 2024-07-09 02:19:09 | 2024-07-09 02:19:09 |
Judging History
answer
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define INF 0x3f3f3f3f3f3f3f3f
#define ones(x) __builtin_popcountll(x)
#define memss(a, b, sz) memset(arr,b,sz * sizeof (arr[0]))
#define ii pair<ll ,ll >
#define PI ::acos(-1)
#define Eiado ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
typedef long long ll;
typedef long double ld;
#define int ll
typedef unsigned long long ull;
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef pair<long long, long long> pll;
typedef pair<ll, ll> pii;
template<typename T = ll>
istream &operator>>(istream &in, vector<T> &v) {
for (auto &x: v) in >> x;
return in;
}
template<typename T = ll>
ostream &operator<<(ostream &out, const vector<T> &v) {
for (const T &x: v) out << x << ' ';
return out;
}
/*
*
*/
///const int N = 5e5 + 5, b = 1e9 + 9, b2 = 31, mod = 1e9 + 7;
const ll inf = 1e18;
const ll M = 998244353;
const ld pi = atan2(0, -1);
const ld eps = 1e-6;
const int mod = 1e9 + 7;
#define x first
#define y second
int add(int a, int b) {
return (a + b + mod) % mod;
}
void solve() {
double n;
cin >> n;
vector<int> v(n);
cin >> v;
sort(rall(v));
vector<int>pre(n+1);
for (int i = 1; i <n+1 ; ++i) {
pre[i]=pre[i-1]+v[i-1];
}
int last=1;
for (int i = 2; i < n+1; ++i) {
int x=pre[i-1]*2;
if(lower_bound(all(pre),x)==pre.end())
{
cout<<last;
return;
}
last=lower_bound(all(pre),x)-pre.begin();
cout<<last;
return;
}
}
signed main() {
#ifndef ONLINE_JUDGE
freopen("i.txt", "r", stdin);
freopen("o.txt", "w", stdout);
#endif
Eiado
// priority_queue<PII, vector<PII>, greater<PII> > pq;
//pq.emplace(a,make_pair(b,c));
/*
E E E E 0 D
E D
E E E E I A A A D D D
E I A A D D
E E E E I A A A A D D D
A
*/
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
/*
* int pw[N], pw2[N], inv[N], inv2[N], pref[N], pref2[N], prf[N],
prf2[N];
int add(int a, int b) {
return (a + b) % mod;
}
int mul(int a, int b) {
return 1ll * a * b % mod;
}
int fp(int b, int p) {
if (p == 0) return 1;
int ret = fp(b, p >> 1);
ret = mul(ret, ret);
if (p & 1) ret = mul(ret, b);
return ret;
}
void pre() {
pw[0] = pw2[0] = inv[0] = inv2[0] = 1;
int mul_inv = fp(b, mod - 2), mul_inv2 = fp(b2, mod - 2);
for (int i = 1; i < N; i++) {
pw[i] = mul(pw[i - 1], b);
pw2[i] = mul(pw2[i - 1], b2);
inv[i] = mul(inv[i - 1], mul_inv);
inv2[i] = mul(inv2[i - 1], mul_inv2);
}
}
pair<int, int> get_hash(int l, int r) {
int ret = pref[r];
if (l) ret = (ret - pref[l - 1] + mod) % mod;
ret = mul(ret, inv[l]);
int ret2 = pref2[r];
if (l) ret2 = (ret2 - pref2[l - 1] + mod) % mod;
ret2 = mul(ret2, inv2[l]);
return {ret, ret2};
}
pair<int, int> get_hash2(int l, int r) {
int ret = prf[r];
if (l) ret = (ret - prf[l - 1] + mod) % mod;
ret = mul(ret, inv[l]);
int ret2 = prf2[r];
if (l) ret2 = (ret2 - prf2[l - 1] + mod) % mod;
ret2 = mul(ret2, inv2[l]);
return {ret, ret2};
}
*/
详细
Test #1:
score: 0
Wrong Answer
time: 65ms
memory: 11008kb
input:
500000 976631732 51389671 729809897 630844317 294721017 903231515 477913449 871071076 636104080 345822085 97441187 499323378 522845426 310022664 199310190 776622973 602672555 646874222 214723272 285341530 962727359 681361226 47426538 272153520 693133904 542337627 556307610 325596239 95738088 5495543...
output:
3
result:
wrong answer 1st lines differ - expected: '155101', found: '3'