Submission #1099759

# Submission time Handle Problem Language Result Execution time Memory
1099759 2024-10-12T05:11:46 Z model_code Nile (IOI24_nile) C++17
0 / 100
28 ms 4816 KB
// incorrect/bakry_wa_permutation.cpp

#include <bits/stdc++.h>

using namespace std ;

vector<long long>calculate_costs(vector<int>W, vector<int>A, vector<int>B, vector<int>E) {
	vector< array<int , 3> >ord;
	int n = W.size(), q = E.size();
	for(int i = 0; i < n; ++i)
		ord.push_back({W[i], A[i], B[i]});
	sort(ord.begin(), ord.end());
	for(int i = 0; i < n; ++i)
		W[i] = ord[i][0], A[i] = ord[i][1], B[i] = ord[i][2];
	int d = E[0];
	vector<long long>dp(n+2);
	dp[0] = A[0];
	if(n == 1)
		return {A[0]};
	dp[1] = B[0] + B[1];
	for(int i = 2; i < n; ++i)
		dp[i] = min(dp[i-1] + A[i], dp[i-2] + B[i-2] + B[i-1]);
	return {dp[n-1]};
}

Compilation message

nile.cpp: In function 'std::vector<long long int> calculate_costs(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
nile.cpp:9:20: warning: unused variable 'q' [-Wunused-variable]
    9 |  int n = W.size(), q = E.size();
      |                    ^
nile.cpp:15:6: warning: unused variable 'd' [-Wunused-variable]
   15 |  int d = E[0];
      |      ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
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 Incorrect 25 ms 4816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 4812 KB Output isn't correct
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 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 4812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -