#include <bits/stdc++.h>
#include "fish.h"
using namespace std;
#define endl '\n'
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(x) x.begin(), x.end()
#define fastio\
ios_base::sync_with_stdio(0);\
cin.tie(0);\
cout.tie(0)\
long long max_weights(int n, int m, vi x, vi y, vi w){
bool flag = true;
for(int i : x){
if(i & 1){
flag = false;
}
}
if(flag){
ll res = 0;
for(int i : w){
res += i;
}
return res;
}
map<int, pii> mp;
for(int i = 0; i < m; i++){
if(x[i] == 0) mp[y[i]].first = i;
else mp[y[i]].second = i;
}
ll res = 0;
for(auto i : mp){
if(i.second.first == 0){
res += w[i.second.second];
}
else if(i.second.second == 0){
res += w[i.second.first];
}
else{
res += max(w[i.second.first], w[i.second.second]);
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
2148 KB |
Output is correct |
2 |
Correct |
27 ms |
2632 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
86 ms |
7276 KB |
Output is correct |
6 |
Correct |
93 ms |
7264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
122 ms |
9660 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '56666856824716' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
15 ms |
1488 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
15 ms |
1488 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
2148 KB |
Output is correct |
2 |
Correct |
27 ms |
2632 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
86 ms |
7276 KB |
Output is correct |
6 |
Correct |
93 ms |
7264 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Incorrect |
122 ms |
9660 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '56666856824716' |
9 |
Halted |
0 ms |
0 KB |
- |