답안 #979329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
979329 2024-05-10T16:01:00 Z Isam 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 13396 KB
#include "candies.h"

#include<bits/stdc++.h>
using namespace std;

constexpr int sz = 2e5 + 5;

int n, Q;

vector<int> a;


std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v){
	
	n = (int)c.size(), Q = (int)r.size();
	
	a.assign(n, 0);
	
	for(register int q = 0; q < Q; ++q){
		
		for(register int i = l[q]; i <= r[q]; ++i){
			
			if(v[q] > 0){
				a[i] = min(c[i], a[i] + v[q]);
			}else{
				a[i] = max(0, a[i] + v[q]);
			}
			
		}
		
	}
	
	
	
	
	
	return a;
	
	
	
	
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int q = 0; q < Q; ++q){
      |                   ^
candies.cpp:21:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |   for(register int i = l[q]; i <= r[q]; ++i){
      |                    ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5020 ms 7504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 162 ms 8172 KB Output is correct
3 Correct 172 ms 6796 KB Output is correct
4 Execution timed out 5006 ms 13396 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 406 ms 7636 KB Output is correct
4 Correct 402 ms 4844 KB Output is correct
5 Execution timed out 5014 ms 10972 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Execution timed out 5020 ms 7504 KB Time limit exceeded
7 Halted 0 ms 0 KB -