# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
598547 | 2022-07-18T13:40:34 Z | definitelynotmee | 사탕 분배 (IOI21_candies) | C++17 | 465 ms | 13652 KB |
#include "candies.h" #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(x) x.begin(), x.end() using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename t> using matrix = vector<vector<t>>; 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(); vector<int> s(n); if(n <= 2000){ for(int i = 0; i < l.size(); i++){ for(int j = l[i]; j <= r[i]; j++){ s[j]+=v[i]; s[j]= min(c[j],s[j]); s[j] = max(0,s[j]); } } } else { vector<ll> delta(n+1); for(int i = 0; i < l.size(); i++){ delta[l[i]]+=v[i]; delta[r[i]+1]-=v[i]; } ll cur = 0; for(int i = 0; i < n; i++){ cur+=delta[i]; s[i] = min(ll(c[i]),cur); } } return s; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 109 ms | 13652 KB | Output is correct |
2 | Correct | 101 ms | 12884 KB | Output is correct |
3 | Correct | 94 ms | 12848 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 189 ms | 8032 KB | Output is correct |
3 | Incorrect | 46 ms | 6444 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 465 ms | 7768 KB | Output is correct |
4 | Incorrect | 47 ms | 5428 KB | Output isn't correct |
5 | 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 | 340 KB | Output is correct |
6 | Correct | 109 ms | 13652 KB | Output is correct |
7 | Correct | 101 ms | 12884 KB | Output is correct |
8 | Correct | 94 ms | 12848 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 189 ms | 8032 KB | Output is correct |
11 | Incorrect | 46 ms | 6444 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |