# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1106938 | 2024-10-31T09:28:20 Z | I_am_Polish_Girl | 메기 농장 (IOI22_fish) | C++17 | 1000 ms | 10716 KB |
/* In honor of Anton Tsypko I want earrings with minecreaft I want earrings with birbie */ #include "fish.h" #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> #include <bitset> #include <cmath> #include <string> using namespace std; int log_ = 23; int inf = 2000000007; int mod = 1000000007; int p = 523; #include <vector> long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { int n = N; vector <vector <pair <int, int>>> vp(n); for (int i = 0; i < X.size(); i++) { vp[X[i]].push_back({ Y[i] , W[i] }); } for (int i = 0; i < n; i++) { sort(vp[i].begin(), vp[i].end()); } vector <int> dp(n); int mx = 0; for (int i = 0; i < n ; i++) { vector <vector <int>> dp_; dp_.resize(n); for (int j = 0; j < n; j++) { dp_[j].resize(vp[j].size()); } int c = mx; for (int j = i; j < n; j++) { int ind = -1; int mx_ = 0; for (int k = 0; k < vp[j].size(); k++) { if (j == i) { mx_ += vp[j][k].second; dp_[j][k] = mx_; dp[i] = max(dp[i], mx_ + c); continue; } while ((ind + 1 != vp[j - 1].size()) and (vp[j - 1][ind + 1].first < vp[j][k].first)) { mx_ = max(mx_, dp_[j - 1][ind + 1]); ind++; } if (mx_ == 0) continue; dp_[j][k] = mx_ + vp[j][k].second; mx_ = max(mx_, dp_[j][k]); if (j != n - 1) dp[j] = max(dp[j], mx_ + c); } } dp_.clear(); dp_.resize(n); for (int j = 0; j < n; j++) { dp_[j].resize(vp[j].size()); } if (i != 0) { for (int j = i; j < n; j++) { int ind = 0; int mx_ = 0; for (int k = 0; k < vp[j].size(); k++) { dp_[j][k] = 0; if (j == i) { mx_ += vp[j][k].second; dp_[j][k] = mx_; dp[i] = max(dp[i], mx_ + c); continue; } while ((ind + 1 < vp[j - 1].size()) and (vp[j - 1][ind + 1].first > vp[j][k].first)) { mx_ = max(mx_, dp_[j - 1][ind + 1]); ind++; } if (mx_ == 0) continue; dp_[j][k] = mx_ + vp[j][k].second; mx_ = max(mx_, dp_[j][k]); if (j != n - 1) dp[j] = max(dp[j], mx_ + c); } } } if (i - 1 >= 0) mx = max(dp[i - 1], mx); } int ans = 0; for (int i = 0; i < n; i++) { ans = max(ans, dp[i]); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 7812 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Execution timed out | 1068 ms | 10716 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1040 ms | 5528 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 588 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Incorrect | 1 ms | 336 KB | 1st lines differ - on the 1st token, expected: '2', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 588 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Incorrect | 1 ms | 336 KB | 1st lines differ - on the 1st token, expected: '2', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 588 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Incorrect | 1 ms | 336 KB | 1st lines differ - on the 1st token, expected: '2', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1040 ms | 5528 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 7812 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |