답안 #1010161

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1010161 2024-06-28T12:11:30 Z mindiyak 사탕 분배 (IOI21_candies) C++17
38 / 100
5000 ms 14164 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include "candies.h"
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<long> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
 
vi distribute_candies(vi c, vi l,vi r, vi v) {
    int n = c.size();
    vi ans(n,0);
    FOR(i,0,l.size()){
        FOR(j,l[i],r[i]+1){
            ans[j] = min(max(0,ans[j]+v[i]),c[j]);
        }
    }
    return ans;
}

Compilation message

candies.cpp: In function 'vi distribute_candies(vi, vi, vi, vi)':
candies.cpp:22:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 | #define FOR(i, a, b) for (int i = a; i < (b); i++)
      |                                        ^
candies.cpp:44:5: note: in expansion of macro 'FOR'
   44 |     FOR(i,0,l.size()){
      |     ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2782 ms 7496 KB Output is correct
2 Correct 2778 ms 7484 KB Output is correct
3 Correct 2774 ms 7496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 64 ms 8060 KB Output is correct
3 Correct 58 ms 6040 KB Output is correct
4 Correct 2947 ms 13396 KB Output is correct
5 Correct 2727 ms 13808 KB Output is correct
6 Correct 2657 ms 14164 KB Output is correct
7 Correct 2685 ms 13536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 110 ms 7784 KB Output is correct
4 Correct 107 ms 3928 KB Output is correct
5 Execution timed out 5026 ms 10856 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2782 ms 7496 KB Output is correct
7 Correct 2778 ms 7484 KB Output is correct
8 Correct 2774 ms 7496 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 64 ms 8060 KB Output is correct
11 Correct 58 ms 6040 KB Output is correct
12 Correct 2947 ms 13396 KB Output is correct
13 Correct 2727 ms 13808 KB Output is correct
14 Correct 2657 ms 14164 KB Output is correct
15 Correct 2685 ms 13536 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 110 ms 7784 KB Output is correct
19 Correct 107 ms 3928 KB Output is correct
20 Execution timed out 5026 ms 10856 KB Time limit exceeded
21 Halted 0 ms 0 KB -