답안 #1058599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1058599 2024-08-14T11:26:16 Z qwusha 사탕 분배 (IOI21_candies) C++17
0 / 100
5000 ms 10072 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
typedef long double ld;
const ld eps = 1e-8;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const ll inf = 1e18;
const ll mod = 1e9 + 7;


vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = c.size();
    vector<int> res(n);
    for (int qw = 0; qw < l.size(); qw++) {
        for (int i = l[qw]; i <= r[qw]; i++) {
            if (v[qw] > 0) {
                res[i] = min(res[i] + v[qw], c[i]);
            } else {
                res[i] = max(res[i] - v[qw], 0);
            }
        }
    }
    return res;
}

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:19:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int qw = 0; qw < l.size(); qw++) {
      |                      ~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5037 ms 10072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -