Submission #979330

# Submission time Handle Problem Language Result Execution time Memory
979330 2024-05-10T16:02:08 Z Isam Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7396 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] = 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){
      |                    ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5067 ms 7256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 177 ms 4948 KB Output is correct
3 Correct 158 ms 4676 KB Output is correct
4 Execution timed out 5048 ms 7396 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 409 ms 5160 KB Output is correct
4 Correct 408 ms 3664 KB Output is correct
5 Execution timed out 5059 ms 7252 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 2 ms 348 KB Output is correct
6 Execution timed out 5067 ms 7256 KB Time limit exceeded
7 Halted 0 ms 0 KB -