Submission #1329862

#TimeUsernameProblemLanguageResultExecution timeMemory
1329862model_codeSubset Mex (EGOI22_subsetmex)C++20
100 / 100
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    if (scanf("%d", &t) != 1) return 0;

    while (t--) {
        int n;
        scanf("%d", &n);
        vector<long long> f(n), q(n + 1);
        for (auto &x : f) scanf("%lld", &x);

        q[n] = 1;
        for (int i = n - 1; i >= 0; --i) {
            q[i] = accumulate(q.begin(), q.end(), 0LL);
            q[i] = max(q[i] - f[i], 0LL);
        }
        printf("%lld\n", accumulate(q.begin(), q.end(), 0LL));
    }
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
Main.cpp:12:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         for (auto &x : f) scanf("%lld", &x);
      |                           ~~~~~^~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...