# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
827880 | 2023-08-16T21:20:15 Z | Seb | 메기 농장 (IOI22_fish) | C++17 | 108 ms | 15580 KB |
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define f first #define s second long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) { if (N==2) { ll a=0,b=0; for (int i=0;i<M;i++) { if (X[i]==0) a += W[i]; else b += W[i]; } return max(a,b); } else { ll ans = 0,a=0,b=0,p0=0,p1=0; vector <pair<ll,ll>> cero,uno; for (int i=0;i<M;i++) { if (X[i]==1) { b += W[i]; uno.push_back({Y[i],W[i]}); } else cero.push_back({Y[i],W[i]}); } sort(cero.begin(),cero.end()); sort(uno.begin(),uno.end()); for (p0=0;p0<cero.size();p0++) { ans = max(ans,a+b); a += cero[p0].s; while (p1<uno.size() && uno[p1].f <= cero[p0].f) { b -= uno[p1].s; p1++; } } ans = max(ans,a+b); return ans; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 4320 KB | Output is correct |
2 | Correct | 32 ms | 4796 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 108 ms | 15580 KB | Output is correct |
6 | Correct | 98 ms | 15580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 50 ms | 7240 KB | Output is correct |
3 | Correct | 63 ms | 11812 KB | Output is correct |
4 | Correct | 25 ms | 5700 KB | Output is correct |
5 | Correct | 40 ms | 6572 KB | Output is correct |
6 | Correct | 0 ms | 296 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 296 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 24 ms | 5724 KB | Output is correct |
13 | Correct | 31 ms | 6564 KB | Output is correct |
14 | Correct | 26 ms | 5240 KB | Output is correct |
15 | Correct | 32 ms | 5692 KB | Output is correct |
16 | Correct | 32 ms | 5332 KB | Output is correct |
17 | Correct | 28 ms | 5680 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 17 ms | 2636 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722340820661' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 17 ms | 2636 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722340820661' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 4320 KB | Output is correct |
2 | Correct | 32 ms | 4796 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 108 ms | 15580 KB | Output is correct |
6 | Correct | 98 ms | 15580 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 50 ms | 7240 KB | Output is correct |
9 | Correct | 63 ms | 11812 KB | Output is correct |
10 | Correct | 25 ms | 5700 KB | Output is correct |
11 | Correct | 40 ms | 6572 KB | Output is correct |
12 | Correct | 0 ms | 296 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 296 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 24 ms | 5724 KB | Output is correct |
19 | Correct | 31 ms | 6564 KB | Output is correct |
20 | Correct | 26 ms | 5240 KB | Output is correct |
21 | Correct | 32 ms | 5692 KB | Output is correct |
22 | Correct | 32 ms | 5332 KB | Output is correct |
23 | Correct | 28 ms | 5680 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Incorrect | 17 ms | 2636 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722340820661' |
27 | Halted | 0 ms | 0 KB | - |