# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870620 | 2023-11-08T14:28:36 Z | Ludissey | Catfish Farm (IOI22_fish) | C++17 | 100 ms | 16592 KB |
#include "fish.h" #include <bits/stdc++.h> #define int long long using namespace std; long long max_weights(signed N, signed M, std::vector<signed> X, std::vector<signed> Y, std::vector<signed> W) { int rightsum=0,leftsum=0; vector<pair<int,int>> X0; vector<pair<int,int>> X1; for (int i = 0; i < M; i++){ if(X[i]==0) { X0.push_back({Y[i], W[i]}); leftsum+=W[i]; } else { X1.push_back({Y[i], W[i]}); rightsum+=W[i]; } } sort(X0.begin(),X0.end()); sort(X1.begin(),X1.end()); int li=0,ri=0; int clsum=0; int crsum=rightsum; int sm=max(leftsum,rightsum); while(li<X0.size()&&ri<X1.size()){ if(X0[li].first<X1[ri].first||(X0[li].first==X1[ri].first&&X0[li].second<X1[ri].second)){ clsum+=X0[li].second; if(X0[li].first==X1[ri].first){ crsum-=X1[ri].second; ri++; } li++; }else { crsum-=X1[ri].second; if(X0[li].first==X1[ri].first){ clsum+=X0[li].second; li++; } ri++; } sm=max(sm, clsum+crsum); } if(N>2) return sm; return max(leftsum,rightsum); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 4300 KB | Output is correct |
2 | Correct | 30 ms | 4808 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 100 ms | 16592 KB | Output is correct |
6 | Incorrect | 96 ms | 16060 KB | 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 49 ms | 7256 KB | Output is correct |
3 | Correct | 60 ms | 8384 KB | Output is correct |
4 | Correct | 24 ms | 4320 KB | Output is correct |
5 | Correct | 31 ms | 6608 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 24 ms | 5720 KB | Output is correct |
13 | Correct | 30 ms | 6700 KB | Output is correct |
14 | Correct | 25 ms | 5356 KB | Output is correct |
15 | Correct | 28 ms | 5828 KB | Output is correct |
16 | Correct | 25 ms | 5324 KB | Output is correct |
17 | Correct | 28 ms | 5840 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 17 ms | 2772 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970317066' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 376 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '310912587092' |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 376 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '310912587092' |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 376 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '216624184325', found: '310912587092' |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 17 ms | 2772 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970317066' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 4300 KB | Output is correct |
2 | Correct | 30 ms | 4808 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 100 ms | 16592 KB | Output is correct |
6 | Incorrect | 96 ms | 16060 KB | 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 | Halted | 0 ms | 0 KB | - |