답안 #548626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
548626 2022-04-14T03:10:53 Z cig32 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 10856 KB
#include "candies.h"
#include "bits/stdc++.h"
using namespace std;

#include <cassert>
#include <cstdio>
#include <vector>


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();
  int p[n], invp[n];
  for(int i=0; i<n; i++) p[i] = 0, invp[i] = c[i];
  for(int i=0; i<q; i++) {
    for(int j=l[i]; j<=r[i]; j++) {
      p[j] += v[i];
      invp[j] -= v[i];
      if(p[j] < 0) {
        p[j] = 0, invp[j] = c[j];
      }
      if(invp[j] < 0) {
        invp[j] = 0, p[j] = c[j];
      }
    }
  }
  for(int i=0; i<n; i++) s[i] = p[i];
  return s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 7 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5052 ms 8804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 231 ms 8048 KB Output is correct
3 Correct 238 ms 7440 KB Output is correct
4 Execution timed out 5053 ms 10856 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 1852 ms 5036 KB Output is correct
4 Correct 2039 ms 4360 KB Output is correct
5 Execution timed out 5054 ms 8804 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 7 ms 520 KB Output is correct
6 Execution timed out 5052 ms 8804 KB Time limit exceeded
7 Halted 0 ms 0 KB -