# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
728511 | 2023-04-22T14:40:13 Z | kwongweng | 메기 농장 (IOI22_fish) | C++17 | 137 ms | 18384 KB |
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef pair<ll, ll> pll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define ms memset #define pb push_back #define fi first #define se second ll max_weights(int n, int m, vi X, vi Y, vi W) { vii a0, a1; FOR(i,0,m){ if (X[i] == 0) a0.pb({Y[i], W[i]}); else a1.pb({Y[i], W[i]}); } sort(a0.begin(), a0.end()); sort(a1.begin(), a1.end()); ll ans = 0; FOR(i,0,a1.size()){ ans += a1[i].se; } if (n == 2){ ll ans0 = 0; FOR(i,0,a0.size()){ ans0 += a0[i].se; } return max(ans, ans0); } ll cur = ans; int j = 0; FOR(i,0,a0.size()){ cur += a0[i].se; if (j >= a1.size()){ ans = max(ans, cur); continue; } while (a0[i].fi >= a1[j].fi && j < a1.size()){ cur -= a1[j].se; j++; } ans = max(ans, cur); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 4672 KB | Output is correct |
2 | Correct | 38 ms | 5552 KB | Output is correct |
3 | Correct | 0 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 123 ms | 17868 KB | Output is correct |
6 | Incorrect | 137 ms | 18384 KB | 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 62 ms | 8552 KB | Output is correct |
3 | Correct | 76 ms | 10304 KB | Output is correct |
4 | Correct | 32 ms | 4696 KB | Output is correct |
5 | Correct | 40 ms | 5544 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 292 KB | Output is correct |
11 | Correct | 1 ms | 300 KB | Output is correct |
12 | Correct | 29 ms | 4700 KB | Output is correct |
13 | Correct | 39 ms | 5540 KB | Output is correct |
14 | Correct | 43 ms | 4468 KB | Output is correct |
15 | Correct | 35 ms | 4936 KB | Output is correct |
16 | Correct | 30 ms | 4680 KB | Output is correct |
17 | Correct | 33 ms | 5064 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 20 ms | 3096 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 308 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 308 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 308 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 20 ms | 3096 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 4672 KB | Output is correct |
2 | Correct | 38 ms | 5552 KB | Output is correct |
3 | Correct | 0 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 123 ms | 17868 KB | Output is correct |
6 | Incorrect | 137 ms | 18384 KB | 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 | Halted | 0 ms | 0 KB | - |