답안 #495595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495595 2021-12-19T12:12:54 Z Half 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 13252 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"DEBUG "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    int n = c.size();
    std::vector<int> s(n);
    int q = l.size();
    if(n*q<=100000000){
        for(int i = 0; i < n; i++){
            ll nc = 0;
            for(int j = 0; j < q; j++){
                if(l[j] <= i && i <= r[j]){
                    nc = max(0LL, min((ll)c[i], nc + (ll)v[j]));
                }
            }
            s[i] = nc;
        }
        return s;
    }
}

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:38:1: warning: control reaches end of non-void function [-Wreturn-type]
   38 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 11 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5010 ms 12124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1808 ms 8028 KB Output is correct
3 Correct 791 ms 6008 KB Output is correct
4 Execution timed out 5061 ms 13252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 851 ms 7660 KB Output is correct
4 Correct 859 ms 4008 KB Output is correct
5 Execution timed out 5055 ms 10820 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 11 ms 308 KB Output is correct
6 Execution timed out 5010 ms 12124 KB Time limit exceeded
7 Halted 0 ms 0 KB -