Submission #770379

# Submission time Handle Problem Language Result Execution time Memory
770379 2023-07-01T06:27:57 Z Trisanu_Das Let's Win the Election (JOI22_ho_t3) C++17
0 / 100
193 ms 2268 KB
#include <bits/stdc++.h>
using namespace std;
#define b first
#define a second
 
int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n, k; cin >> n >> k;
  pair<int, int> st[n];
  for(int i = 0; i < n; i++){
    cin >> st[i].a >> st[i].b;
    if(st[i].b == -1) st[i].b = 1000000000;
  }
  sort(st, st + n);
  double ans = INT_MAX;
  for(int x = 0; x < k; x++){
    double dp[n + 1][k - x + 1]; memset(dp, INT_MAX, sizeof(dp));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++)
			for (int j = 0; j < k - x + 1; j++) {
				if (j < k - x) dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + (double) st[i].a / (x + 1));
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + (i - j < x ? (double) st[i].b / (i - j + 1) : .0));
			}
		ans = min(ans, dp[n][k - x]);
  }
  cout << fixed << setprecision(9) << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 193 ms 2268 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -