답안 #435735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
435735 2021-06-23T16:18:48 Z illyakr 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 7264 KB
#include <bits/stdc++.h>
#include "candies.h"
using namespace std;

vector<int> res;
int n, q;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    n = c.size(); q = v.size();
    res.resize(n, 0);
    if (n * q <= 100000000) {
        for (int i = 0; i < q; i++) {
            for (int j = l[i]; j <= r[i]; j++) {
                res[j] += v[i];
                if (res[j] < 0)res[j] = 0;
                else if (res[j] > c[j])res[j] = c[j];
            }
        }
        return res;
    }
}

/**
3
10 15 13
2
0 2 20
0 1 -11


0 4 13
*/

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5072 ms 7264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 256 ms 5060 KB Output is correct
3 Correct 247 ms 4588 KB Output is correct
4 Execution timed out 5085 ms 7236 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1706 ms 5016 KB Output is correct
4 Correct 2563 ms 3584 KB Output is correct
5 Execution timed out 5036 ms 7256 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
6 Execution timed out 5072 ms 7264 KB Time limit exceeded
7 Halted 0 ms 0 KB -