Submission #1016227

# Submission time Handle Problem Language Result Execution time Memory
1016227 2024-07-07T14:30:37 Z pawned Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13232 KB
#pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
 
#include <bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
 
#include "candies.h"
 
vi distribute_candies(vi C, vi L, vi R, vi V) {
	int N = C.size();
	int Q = V.size();
	vi ans(N, 0);
	for (int i = 0; i < Q; i++) {
		for (int j = L[i]; j <= R[i]; j++) {
			ans[j] += V[i];
			ans[j] = max(ans[j], 0);
			ans[j] = min(ans[j], C[j]);
		}
	}
	return ans;
}

Compilation message

candies.cpp:1:55: warning: bad option '-f O2' to pragma 'optimize' [-Wpragmas]
    1 | #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
      |                                                       ^
candies.cpp:1:55: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
candies.cpp:1:55: warning: bad option '-f Ofast' to pragma 'optimize' [-Wpragmas]
candies.cpp:1:55: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
In file included from candies.cpp:13:
candies.h:4:75: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
    4 |                                     std::vector<int> r, std::vector<int> v);
      |                                                                           ^
candies.h:4:75: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
candies.h:4:75: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
candies.h:4:75: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
candies.h:4:75: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
candies.h:4:75: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
candies.h:4:75: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
candies.h:4:75: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
candies.cpp:15:45: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   15 | vi distribute_candies(vi C, vi L, vi R, vi V) {
      |                                             ^
candies.cpp:15:45: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
candies.cpp:15:45: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
candies.cpp:15:45: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 444 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5071 ms 12116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 343 ms 8180 KB Output is correct
3 Correct 339 ms 5952 KB Output is correct
4 Execution timed out 5056 ms 13232 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 962 ms 7796 KB Output is correct
4 Correct 1044 ms 4036 KB Output is correct
5 Execution timed out 5048 ms 10836 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 444 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Execution timed out 5071 ms 12116 KB Time limit exceeded
7 Halted 0 ms 0 KB -