Submission #1099780

#TimeUsernameProblemLanguageResultExecution timeMemory
1099780model_codeNile (IOI24_nile)C++17
17 / 100
2059 ms4812 KiB
// time_limit/bakry_n2.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]; vector<long long>v; for(int curq = 0; curq < E.size(); ++curq) { int d = E[curq]; vector<long long>dp(n); dp[0] = A[0]; for(int i = 1; i < n; ++i) { dp[i] = dp[i-1] + A[i]; long long sum = 0 ; for(int j = i-1; j >= 0; --j) { if(W[i] - W[j] <= d) { long long x = 0; if(j > 0) x = dp[j-1]; dp[i] = min(dp[i], x + B[i] + B[j] + sum); } sum += A[j]; } } v.push_back(dp[n-1]); } return v; }

Compilation message (stderr)

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:16:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int curq = 0; curq < E.size(); ++curq)
      |                    ~~~~~^~~~~~~~~~
nile.cpp:9:20: warning: unused variable 'q' [-Wunused-variable]
    9 |  int n = W.size(), q = E.size();
      |                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...