#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const int N = 1e5+5;
ll a[N];
vector<int> v;
int main(void)
{ IO
ll n, i, Q, t, L, R, j, sum, ans;
bool ff;
cin >> n;
for (i=1; i <= n; ++i) cin >> a[i];
cin >> Q;
do {
cin >> t >> L >> R;
if (t == 1)
{
assert(0);
} else {
ans = 0;
for (i=1; i <= n; ++i)
{
v.clear();
for (j=1, sum=a[i]; j <= n; ++j)
{
if (i == j) continue;
if (a[j] > a[i]) v.pb(a[j]);
else sum += a[j];
}
sort(all(v));
ff = 0;
for (int x : v)
{
if (sum >= x)
{
sum += x;
} else ff = 1;
}
if (!ff) ++ans;
}
cout << ans << '\n';
}
} while (--Q);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |