답안 #605742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
605742 2022-07-26T01:12:25 Z skittles1412 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 7272 KB
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
    cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t << " | ";
    dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__);
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())

vector<int> distribute_candies(vector<int> arr,
                               vector<int> ql,
                               vector<int> qr,
                               vector<int> qv) {
    int n = sz(arr), q = sz(ql);
    int ans[n] {};
    for (int qi = 0; qi < q; qi++) {
        int l = ql[qi], r = qr[qi], v = qv[qi];
        if (v >= 0) {
            for (int i = l; i <= r; i++) {
                ans[i] += v;
            }
#pragma GCC ivdep
            for (int i = l; i <= r; i++) {
                ans[i] = min(ans[i], arr[i]);
            }
        } else {
            for (int i = l; i <= r; i++) {
                ans[i] = max(0, ans[i] + v);
            }
        }
    }
    return vector<int>(ans, ans + n);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5064 ms 7268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 108 ms 5020 KB Output is correct
3 Correct 108 ms 4596 KB Output is correct
4 Execution timed out 5048 ms 7272 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 219 ms 5016 KB Output is correct
4 Correct 228 ms 3568 KB Output is correct
5 Execution timed out 5075 ms 7244 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Execution timed out 5064 ms 7268 KB Time limit exceeded
7 Halted 0 ms 0 KB -