Submission #944147

# Submission time Handle Problem Language Result Execution time Memory
944147 2024-03-12T09:03:21 Z teacup Meetings (IOI18_meetings) C++17
4 / 100
5500 ms 1272 KB
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define ii pair<int,int>
typedef vector<int> vi;
#define iii tuple<int,int,int>
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef map<int,int> mii;
 
#ifndef debug 
    #define cerr if (0) cerr
#endif
 
const int INF=1e17;
 
int32_t A[5005];
 
vi minimum_costs(vector<int32_t> H, vector<int32_t> L,
                                     vector<int32_t> R) {
	int Q = L.size(), N = H.size();
	vi C;
	for (int _=0; _<Q; _++){
		int L_ = L[_], R_ = R[_], actual_ans=INF;
		for (int i=L_; i<=R_; i++){
			int ans=0;
            memset(A,0,sizeof(A));
            A[i] = H[i];
			for (int j = i-1; j >= L_; j--){
				A[j] = max(A[j+1], H[j]);
			}
            for (int j = i+1; j <= R_; j++){
                A[j] = max(A[j-1], H[j]);
            }
            for (int j=L_; j<=R_; j++) ans+=A[j];
			actual_ans = min(ans, actual_ans);
		}
		C.push_back(actual_ans);
	}
	return C;
}

Compilation message

meetings.cpp: In function 'vi minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:23:20: warning: unused variable 'N' [-Wunused-variable]
   23 |  int Q = L.size(), N = H.size();
      |                    ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 39 ms 452 KB Output is correct
3 Correct 190 ms 348 KB Output is correct
4 Correct 60 ms 448 KB Output is correct
5 Correct 190 ms 452 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 8 ms 348 KB Output is correct
9 Correct 189 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 39 ms 452 KB Output is correct
3 Correct 190 ms 348 KB Output is correct
4 Correct 60 ms 448 KB Output is correct
5 Correct 190 ms 452 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 8 ms 348 KB Output is correct
9 Correct 189 ms 448 KB Output is correct
10 Execution timed out 5538 ms 552 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 5525 ms 1272 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 5525 ms 1272 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 39 ms 452 KB Output is correct
3 Correct 190 ms 348 KB Output is correct
4 Correct 60 ms 448 KB Output is correct
5 Correct 190 ms 452 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 8 ms 348 KB Output is correct
9 Correct 189 ms 448 KB Output is correct
10 Execution timed out 5538 ms 552 KB Time limit exceeded
11 Halted 0 ms 0 KB -