Submission #881292

#TimeUsernameProblemLanguageResultExecution timeMemory
881292RegulusFish 2 (JOI22_fish2)C++17
0 / 100
1 ms604 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...