# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870618 | 2023-11-08T14:24:07 Z | Ludissey | Catfish Farm (IOI22_fish) | C++17 | 61 ms | 12092 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=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 | Incorrect | 24 ms | 4304 KB | 1st lines differ - on the 1st token, expected: '40313272768926', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 49 ms | 7256 KB | Output is correct |
3 | Correct | 61 ms | 12092 KB | Output is correct |
4 | Incorrect | 25 ms | 5936 KB | 1st lines differ - on the 1st token, expected: '40313272768926', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '0' |
2 | 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 | Correct | 1 ms | 600 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 436 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Incorrect | 1 ms | 600 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 | Correct | 1 ms | 600 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 436 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Incorrect | 1 ms | 600 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 | Correct | 1 ms | 600 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 436 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Incorrect | 1 ms | 600 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 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '10082010', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 4304 KB | 1st lines differ - on the 1st token, expected: '40313272768926', found: '0' |
2 | Halted | 0 ms | 0 KB | - |