Submission #440225

# Submission time Handle Problem Language Result Execution time Memory
440225 2021-07-01T19:12:06 Z BaraaArmoush Distributing Candies (IOI21_candies) C++17
0 / 100
106 ms 19624 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int minimize(int& x, int y) {
    if (x > y) {
        x = y;
    }
}

int maximize(int& x, int y) {
    if (x < y) {
        x = y;
    }
}

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = c.size();
    int q = l.size();

    vector<int> a(n);

    for (int j = 0; j < q; j++) {
        for (int i = l[j]; i <= r[j]; i++) {
            a[i - 1] += v[j];
            maximize(a[i - 1], 0);
            minimize(a[i - 1], c[i - 1]);
        }
    }

    return a;
}

Compilation message

candies.cpp: In function 'int minimize(int&, int)':
candies.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
   11 | }
      | ^
candies.cpp: In function 'int maximize(int&, int)':
candies.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 106 ms 19624 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -