답안 #769130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
769130 2023-06-29T08:23:20 Z jack715 메기 농장 (IOI22_fish) C++17
6 / 100
99 ms 13528 KB
#include "fish.h"

#include <vector>
#include <iostream>
// #include <bits/stdc++.h>
#include <algorithm>  
using namespace std;

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
  long long ans = 0, now = 0, a = 0, b = 0;
  vector<pair<int, pair<int, int> > > nums;
  for (int i = 0; i < M; i++) {
    nums.push_back({Y[i], {X[i], W[i]}});
    if (X[i] == 1)
      now += W[i], b += W[i];
    else 
      a += W[i];
  }

  if (N == 2)
    return max(a, b);
  sort(nums.begin(), nums.end());
  for (int i = 0; i < M; i++) {
    if (i == 0 || nums[i].first != nums[i-1].first)
      ans = max(ans, now);
    if (nums[i].second.first == 0)
      now += nums[i].second.second;
    else 
      now -= nums[i].second.second;
  }

  ans = max(ans, now);
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3808 KB Output is correct
2 Correct 31 ms 4292 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 99 ms 13528 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 50 ms 7320 KB Output is correct
3 Correct 69 ms 11588 KB Output is correct
4 Correct 25 ms 5196 KB Output is correct
5 Correct 30 ms 5940 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 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 24 ms 5188 KB Output is correct
13 Correct 31 ms 6068 KB Output is correct
14 Correct 25 ms 5212 KB Output is correct
15 Correct 29 ms 5572 KB Output is correct
16 Correct 33 ms 5204 KB Output is correct
17 Correct 28 ms 5556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 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 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3808 KB Output is correct
2 Correct 31 ms 4292 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 99 ms 13528 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -