Submission #803392

# Submission time Handle Problem Language Result Execution time Memory
803392 2023-08-03T04:22:33 Z ono_de206 Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7276 KB
#include "candies.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

//#define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

vi distribute_candies(vi c, vi l, vi r, vi v) {
    int n = c.size(), q = l.size();
    if(n * q <= 2000 * 2000) {
        vector<int> ret(n);
        for(int i = 0; i < q; i++) {
            for(int j = l[i]; j <= r[i]; j++) {
                ret[j] += v[i];
                ret[j] = min(c[j], max(0, ret[j]));
            }
        }
        return ret;
    }
}

Compilation message

candies.cpp: In function 'vi distribute_candies(vi, vi, vi, vi)':
candies.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5057 ms 7268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 167 ms 5024 KB Output is correct
3 Correct 149 ms 3796 KB Output is correct
4 Execution timed out 5077 ms 7268 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 381 ms 5028 KB Output is correct
4 Correct 376 ms 2748 KB Output is correct
5 Execution timed out 5083 ms 7276 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Execution timed out 5057 ms 7268 KB Time limit exceeded
7 Halted 0 ms 0 KB -