답안 #1058411

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1058411 2024-08-14T09:52:52 Z vjudge1 사탕 분배 (IOI21_candies) C++17
3 / 100
69 ms 11356 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;

using vi = vector<int>;

vi distribute_candies(vi c, vi l, vi r, vi v) {
    int n = c.size(), q = l.size();
    bool all_poz = true;
    for(auto it : v)
        if(it < 0) all_poz = false;
    if(n <= 2000 && q <= 2000) {
        vi A(n, 0);
        for(int i = 0; i < q; ++i) {
            for(int j = l[i]; j <= r[i]; ++j) {
                A[j] += v[i];
                A[j] = max(A[j], 0);
                A[j] = min(A[j], c[j]);
            }
        }
        return A;
    }
    return vi();
}

Compilation message

candies.cpp: In function 'vi distribute_candies(vi, vi, vi, vi)':
candies.cpp:10:10: warning: variable 'all_poz' set but not used [-Wunused-but-set-variable]
   10 |     bool all_poz = true;
      |          ^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 69 ms 11356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 52 ms 8024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 50 ms 7764 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Incorrect 69 ms 11356 KB Output isn't correct
7 Halted 0 ms 0 KB -