제출 #897625

#제출 시각아이디문제언어결과실행 시간메모리
897625ErJ봉쇄 시간 (IOI23_closing)C++17
35 / 100
1120 ms1566568 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vector<ll>> #define vs vector<string> #define vc vector<char> #define vb vector<bool> #define vp vector<pair<ll, ll>> #define pp pair<ll, ll> #define qi queue<ll> #define qp queue<pp> #define pqi priority_queue<ll> #define pqp priority_queue<pp> #define mi map<ll, ll> #define mpi map<pp, ll> #define mip map<ll, pp> #define mpp map<pp, pp> #define mb map<ll, bool> #define si set<ll> #define sp set<pp> #define mod 1000000007 #define rep(a, b) for(int a = 0; a < (b); a++) #define rep2(a, b) for(int a = 1; a < (b); a++) #define inf 1000000000000000000 int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) { vector<ll> distX(N); vector<ll> distY(N); vector<ll> distXY(N); vector<ll> distXY2(N), distXY3(N); distX[X] = 0; distX[Y] = 0; for (int i = X + 1; i < N; i++) { distX[i] = distX[i - 1] + W[i - 1]; } for (int i = X - 1; i >= 0; i--) { distX[i] = distX[i + 1] + W[i]; } for (int i = Y + 1; i < N; i++) { distY[i] = distY[i - 1] + W[i - 1]; } for (int i = Y - 1; i >= 0; i--) { distY[i] = distY[i + 1] + W[i]; } for (int i = 0; i < N; i++) { distXY[i] = max(distX[i], distY[i]); distXY2[i] = min(distX[i], distY[i]); distXY3[i] = distXY2[i]; } sort(distXY3.begin(), distXY3.end()); ll anslvl1 = 0; ll sum = 0; rep(i, distXY3.size()) { sum += distXY3[i]; if (sum <= K) { anslvl1++; } } vvi dp(N + 1); dp[0].resize(2*N + 1); for (int i = 0; i < 2 * N + 1; i++) { dp[0][i] = inf; } dp[0][0] = 0; for (int i = 1; i < dp.size(); i++) { dp[i].resize(2 * N + 1); if (!(i - 1 >= X && i - 1 <= Y)) { for (int j = 0; j < 2 * N + 1; j++) { dp[i][j] = dp[i - 1][j]; } } else { for (int j = 0; j < 2 * N + 1; j++) { dp[i][j] = inf; } } for (int j = 0; j < 2 * N + 1; j++) { if (dp[i - 1][j] != inf) { dp[i][j + 1] = min(dp[i][j + 1], dp[i - 1][j] + distXY2[i - 1]); dp[i][j + 2] = min(dp[i][j + 2], dp[i - 1][j] + distXY[i - 1]); } } } ll ans = 0; for (int i = 2 * N; i >= 0; i--) { if (dp[N][i] <= K) { ans = i; break; } } return max(ans, anslvl1); }

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

closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:24:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 | #define rep(a, b) for(int a = 0; a < (b); a++)
      |                                    ^
closing.cpp:56:5: note: in expansion of macro 'rep'
   56 |     rep(i, distXY3.size()) {
      |     ^~~
closing.cpp:68:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |     for (int i = 1; i < dp.size(); i++) {
      |                     ~~^~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...