Submission #979325

# Submission time Handle Problem Language Result Execution time Memory
979325 2024-05-10T15:57:51 Z Isam Distributing Candies (IOI21_candies) C++17
0 / 100
5000 ms 12268 KB
#include "candies.h"

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

constexpr int sz = 2e5 + 5;

int n, Q;

vector<int> a;


vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, 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-1] = min(c[i-1], a[i-1] + v[q]);
			}else{
				a[i-1] = max(0, a[i-1] + 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){
      |                    ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5062 ms 12268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -