# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833534 | 2023-08-22T06:38:10 Z | Trumling | 메기 농장 (IOI22_fish) | C++17 | 79 ms | 15680 KB |
#include "fish.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define all(x) x.begin(),x.end() typedef long long ll; #define pb push_back #define INF 9999999999999999 long long max_weights(int N, int M, vector<int> X, vector<int> Y,vector<int> W) { ll sum1=0,sum2=0; vector<pair<ll,ll>>z,o; for(int i=0;i<M;i++) { if(X[i]) { sum1+=W[i]; o.pb({i,W[i]}); } else { sum2+=W[i]; z.pb({i,W[i]}); } } sort(all(z)); sort(all(o)); if(N==2) return max(sum1,sum2); ll maxi=max(sum1,sum2); ll idx=0,l=0,r=0; for(int i=0;i<z.size();i++) { l+=z[i].S; while(idx!=o.size() && o[idx].F<z[i].F) { r+=o[idx].S; idx++; } maxi=max(maxi,l+sum1-r); } return maxi; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 4296 KB | Output is correct |
2 | Correct | 25 ms | 4808 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 75 ms | 15568 KB | Output is correct |
6 | Incorrect | 79 ms | 15680 KB | 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 41 ms | 7252 KB | 1st lines differ - on the 1st token, expected: '40604614618209', found: '40621475040444' |
3 | 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 | 14 ms | 2728 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
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 | 14 ms | 2728 KB | 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 4296 KB | Output is correct |
2 | Correct | 25 ms | 4808 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 75 ms | 15568 KB | Output is correct |
6 | Incorrect | 79 ms | 15680 KB | 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 | Halted | 0 ms | 0 KB | - |