답안 #625994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
625994 2022-08-11T05:59:28 Z sword060 메기 농장 (IOI22_fish) C++17
9 / 100
154 ms 11488 KB
#include <bits/stdc++.h>
#include "fish.h"
using namespace std;
long long max_weights(int x,int k,vector<int> a,vector<int> b,vector<int> c){
  vector<pair<int,int>>l[2];
  long long ans=0,cur=0,cur2=0;
  for(int i=0;i<k;i++){
    l[a[i]%2].push_back({b[i],c[i]});
    if(a[i]%2)cur+=c[i];
    else cur2+=c[i];
  }
  sort(l[0].begin(),l[0].end());
  sort(l[1].begin(),l[1].end());
  ans=cur;
  if(x<=2){
    return max(cur,cur2);
  }
  int j=0;
  for(int i=0;i<(int)l[0].size();i++){
    cur+=l[0][i].second;
    while(j<l[1].size()&&l[1][j].first<=l[0][i].first){
      cur-=l[1][j].second;
      j++;
    }
    ans=max(ans,cur);
  }
  return ans;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:21:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     while(j<l[1].size()&&l[1][j].first<=l[0][i].first){
      |           ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3268 KB Output is correct
2 Correct 35 ms 3780 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 154 ms 11488 KB Output is correct
6 Correct 124 ms 11468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 63 ms 5728 KB Output is correct
3 Correct 80 ms 6736 KB Output is correct
4 Correct 29 ms 3276 KB Output is correct
5 Correct 44 ms 3776 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 29 ms 3288 KB Output is correct
13 Correct 35 ms 3764 KB Output is correct
14 Correct 29 ms 3048 KB Output is correct
15 Correct 34 ms 3416 KB Output is correct
16 Correct 30 ms 3152 KB Output is correct
17 Correct 34 ms 3392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 236 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 18 ms 2116 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '13412238152019'
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 1 ms 236 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 18 ms 2116 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '13412238152019'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3268 KB Output is correct
2 Correct 35 ms 3780 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 154 ms 11488 KB Output is correct
6 Correct 124 ms 11468 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 63 ms 5728 KB Output is correct
9 Correct 80 ms 6736 KB Output is correct
10 Correct 29 ms 3276 KB Output is correct
11 Correct 44 ms 3776 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 29 ms 3288 KB Output is correct
19 Correct 35 ms 3764 KB Output is correct
20 Correct 29 ms 3048 KB Output is correct
21 Correct 34 ms 3416 KB Output is correct
22 Correct 30 ms 3152 KB Output is correct
23 Correct 34 ms 3392 KB Output is correct
24 Correct 1 ms 236 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Incorrect 18 ms 2116 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '13412238152019'
27 Halted 0 ms 0 KB -