# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
705102 | 2023-03-03T11:36:55 Z | danikoynov | 메기 농장 (IOI22_fish) | C++17 | 132 ms | 13960 KB |
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 10; vector < pair < int, int > > col[maxn]; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { bool all_even = true, small_x = true; for (int i = 0; i < M; i ++) { if (X[i] % 2 != 0) all_even = false; if (X[i] > 1) small_x = false; } for (int i = 0; i < M; i ++) { col[X[i]].push_back({Y[i], W[i]}); } for (int i = 0; i < N; i ++) sort(col[i].begin(), col[i].end()); if (all_even) { ll sum = 0; for (int i = 0; i < M; i ++) sum = sum + W[i]; return sum; } else if (small_x) { ll zero = 0, one = 0; for (int i = 0; i < M; i ++) { if (X[i] == 0) zero += W[i]; else one += W[i]; } if (N == 2) return max(zero, one); int to = 0; ll cur = 0, ans = 0; for (int i = 0; i < col[0].size(); i ++) { if (cur + one > ans) ans = cur + one; cur += col[0][i].second; while(to < col[1].size() && col[1][to].first <= col[0][i].first) { one -= col[1][to].second; to ++; } } if (cur + one > ans) ans = cur + one; return ans; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 5708 KB | Output is correct |
2 | Correct | 37 ms | 6112 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 2 ms | 2644 KB | Output is correct |
5 | Correct | 128 ms | 12284 KB | Output is correct |
6 | Correct | 132 ms | 13960 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 60 ms | 8036 KB | Output is correct |
3 | Correct | 79 ms | 12536 KB | Output is correct |
4 | Correct | 32 ms | 7052 KB | Output is correct |
5 | Correct | 48 ms | 7892 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2652 KB | Output is correct |
8 | Correct | 2 ms | 2644 KB | Output is correct |
9 | Correct | 2 ms | 2644 KB | Output is correct |
10 | Correct | 1 ms | 2644 KB | Output is correct |
11 | Correct | 2 ms | 2648 KB | Output is correct |
12 | Correct | 32 ms | 7108 KB | Output is correct |
13 | Correct | 38 ms | 7920 KB | Output is correct |
14 | Correct | 32 ms | 6824 KB | Output is correct |
15 | Correct | 43 ms | 7240 KB | Output is correct |
16 | Correct | 32 ms | 6928 KB | Output is correct |
17 | Correct | 38 ms | 7264 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Incorrect | 1 ms | 2644 KB | 1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | 1st lines differ - on the 1st token, expected: '3', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | 1st lines differ - on the 1st token, expected: '3', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | 1st lines differ - on the 1st token, expected: '3', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Incorrect | 1 ms | 2644 KB | 1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 5708 KB | Output is correct |
2 | Correct | 37 ms | 6112 KB | Output is correct |
3 | Correct | 2 ms | 2644 KB | Output is correct |
4 | Correct | 2 ms | 2644 KB | Output is correct |
5 | Correct | 128 ms | 12284 KB | Output is correct |
6 | Correct | 132 ms | 13960 KB | Output is correct |
7 | Correct | 1 ms | 2644 KB | Output is correct |
8 | Correct | 60 ms | 8036 KB | Output is correct |
9 | Correct | 79 ms | 12536 KB | Output is correct |
10 | Correct | 32 ms | 7052 KB | Output is correct |
11 | Correct | 48 ms | 7892 KB | Output is correct |
12 | Correct | 2 ms | 2644 KB | Output is correct |
13 | Correct | 2 ms | 2652 KB | Output is correct |
14 | Correct | 2 ms | 2644 KB | Output is correct |
15 | Correct | 2 ms | 2644 KB | Output is correct |
16 | Correct | 1 ms | 2644 KB | Output is correct |
17 | Correct | 2 ms | 2648 KB | Output is correct |
18 | Correct | 32 ms | 7108 KB | Output is correct |
19 | Correct | 38 ms | 7920 KB | Output is correct |
20 | Correct | 32 ms | 6824 KB | Output is correct |
21 | Correct | 43 ms | 7240 KB | Output is correct |
22 | Correct | 32 ms | 6928 KB | Output is correct |
23 | Correct | 38 ms | 7264 KB | Output is correct |
24 | Correct | 2 ms | 2644 KB | Output is correct |
25 | Incorrect | 1 ms | 2644 KB | 1st lines differ - on the 1st token, expected: '882019', found: '0' |
26 | Halted | 0 ms | 0 KB | - |