답안 #440388

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
440388 2021-07-02T08:23:17 Z i_am_noob 사탕 분배 (IOI21_candies) C++17
8 / 100
140 ms 8904 KB
#include "candies.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long
//#define int ll
#define rep(n) rep1(i,n)
#define rep1(i,n) rep2(i,0,n)
#define rep2(i,a,b) for(int i=a; i<(b); ++i)
#define rep3(i,a,b) for(int i=a; i>=(b); --i)
#define chkmax(a,b) (a=max(a,b))
#define chkmin(a,b) (a=min(a,b))
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define pb push_back
#define pii pair<int,int>
#define pow2(x) (1ll<<(x))
#ifdef zisk
#define bug(...) cerr << "#" << __LINE__ << ": " << #__VA_ARGS__ << "- ", _do(__VA_ARGS__)
template<typename T> void _do(T x){cerr << x << endl;}
template<typename T, typename ...S> void _do(T x, S... y){cerr << x << ", "; _do(y...);}
#else
#define bug(...) 49
#endif

int n,q;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    n=sz(c);
    q=sz(l);
    vector<ll> res(n);
    vector<int> res2(n);
    rep1(j,q){
    	if(r[j]<n-1) res[r[j]+1]-=v[j];
    	res[l[j]]+=v[j];
    }
    rep2(i,1,n) res[i]+=res[i-1];
    rep(n) chkmin(res[i],(ll)c[i]);
    rep(n) res2[i]=res[i];
    return res2;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 8876 KB Output is correct
2 Correct 119 ms 8848 KB Output is correct
3 Correct 125 ms 8904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -