답안 #827094

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827094 2023-08-16T08:41:58 Z NothingXD 사탕 분배 (IOI21_candies) C++17
8 / 100
86 ms 14040 KB
#include "candies.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

void debug_out(){cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cerr << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

const int maxn = 2e5 + 10;

int n, q, c[maxn];
ll a[maxn];
vector<int> distribute_candies(vector<int> C, vector<int> L, vector<int> R, vector<int> V) {
	n = C.size();
	for (int i = 0; i < n; i++){
		c[i] = C[i];
	}
	q = L.size();
	for (int i = 0; i < q; i++){
		a[L[i]] += V[i];
		a[R[i]+1] -= V[i];
	}
	vector<int> ans;
	for (int i = 0; i < n; i++){
		a[i] += a[i-1];
		ans.push_back(min(a[i], (ll)c[i]));
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 244 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 9964 KB Output is correct
2 Correct 86 ms 14040 KB Output is correct
3 Correct 79 ms 13892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 244 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -