| 5 | #define int long long |
| 6 | |
| 7 | int32_t main(){ |
| 8 | ios_base::sync_with_stdio(false),cin.tie(nullptr); |
| 9 | |
| 10 | int n; cin >> n; |
| 11 | vector<int> V(n); rep(i,0,n) cin>> V[i]; |
| 12 | sort(V.begin(),V.end()); |
| 13 | int res = 1; |
| 14 | if (V[0] != 1) { |
| 15 | cout << 1 << endl; |
| 16 | exit(0); |
| 17 | } |
| 18 | for (int i = 0; i < n && V[i] <= res; ++i) { |
| 19 | res += V[i]; |
| 20 | } |
| 21 | cout << res << endl; |
| 22 | return 0; |
| 23 | } |
| 24 | // 1 2 2 7 9 |
| 25 | // Solution :- |
| 26 | // we first check if we have a[0] = 1 then we can make sum = 1 else answer = 1 |
nothing calls this directly
no outgoing calls
no test coverage detected