Submission #881292

# Submission time Handle Problem Language Result Execution time Memory
881292 2023-12-01T03:54:36 Z Regulus Fish 2 (JOI22_fish2) C++17
0 / 100
1 ms 604 KB
#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=0; 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;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -