제출 #1087525

#제출 시각아이디문제언어결과실행 시간메모리
1087525I_am_Polish_GirlLet's Win the Election (JOI22_ho_t3)C++14
56 / 100
1641 ms1048576 KiB
#include <vector> #include <algorithm> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <cmath> #include <random> #include <chrono> #include <iomanip> #include <iostream> using namespace std; #define double long double int log_ = 3; int inf = 2000000000000000000; int mod = 1102024631; int p = 505; bool cmp(pair <int, int> a, pair <int, int> b) { if (a.second < b.second) { return true; } return false; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n , k; cin >> n >> k; vector <pair <int, int>> vp(n); for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; vp[i] = { a, b }; } sort(vp.begin(), vp.end(), cmp); vector <vector <vector <double>>> dp0(n+1); vector <vector <vector <double>>> dp1; for (int i = 0; i <= n; i++) { dp0[i].resize(n + 1); for (int j = 0; j <= n; j++) { dp0[i][j].resize(n + 1 , inf); } } for (int i = 0; i <= n; i++) { dp0[0][0][i] = 0; } dp1 = dp0; for (int k = 0; k < n; k++) { for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) { for (int col = 0; col <= n; col++) { if (i > 0) { if (vp[k].second != -1) { dp1[i][j][col] = min(dp1[i][j][col], dp0[i - 1][j][col] + ((0. + vp[k].second) / i)); } } if (j > 0) { dp1[i][j][col] = min(dp1[i][j][col], dp0[i][j - 1][col] + ((0. + vp[k].first) / (col+1))); } } } } dp0 = dp1; } double ans = inf; for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) { for (int col = 0; col <= n; col++) { if (col <= k) { if (i + j == k) { if (i == col) { ans = min(ans , dp0[i][j][col]); } } } } } } cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:21:11: warning: overflow in conversion from 'long int' to 'int' changes value from '2000000000000000000' to '1321730048' [-Woverflow]
   21 | int inf = 2000000000000000000;
      |           ^~~~~~~~~~~~~~~~~~~
#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...