답안 #827174

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827174 2023-08-16T09:38:00 Z NothingXD 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 10224 KB
    #include "candies.h"
    #include <bits/stdc++.h>
  	#pragma GCC optimize("unroll-loops")
	#pragma GCC optimize("O3")
	#pragma GCC target("avx")
	
	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, a[maxn], c[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++){
    		if (V[i] > 0){
    			for (int j = L[i]; j <= R[i]; j++){
    				a[j] = (a[j]+V[i] >= c[j]? c[j]: a[j]+V[i]);
    			//	debug(j, a[j]);
    			}
    		}
    		if (V[i] < 0){
    			for (int j = L[i]; j <= R[i]; j++){
    				a[j] = (a[j]+V[i] <= 0? 0: a[j]+V[i]);
    			//	debug(j, a[j]);
    			}
    		}
    	}
    	vector<int> ans;
    	for (int i = 0; i < n; i++){
    		ans.push_back(a[i]);
    	}
    	return ans;
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5055 ms 8048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 143 ms 7120 KB Output is correct
3 Correct 128 ms 7704 KB Output is correct
4 Execution timed out 5014 ms 10224 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 345 ms 7228 KB Output is correct
4 Correct 304 ms 5820 KB Output is correct
5 Execution timed out 5024 ms 10212 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 380 KB Output is correct
6 Execution timed out 5055 ms 8048 KB Time limit exceeded
7 Halted 0 ms 0 KB -