답안 #629848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
629848 2022-08-15T09:10:13 Z europium 메기 농장 (IOI22_fish) C++17
0 / 100
312 ms 24540 KB
#include "fish.h"

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include<iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
using namespace std;

using ll = long long;

ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w){

    map<ll,ll> zero, one;
    ll one_sum = 0;

    set<ll> y_cor;

    for (int i = 0; i < m; i++){
        if (x[i] == 0) zero[y[i]] = w[i];
        else{
            one[y[i]] = w[i];
            one_sum += w[i];
        }
        y_cor.insert(y[i]);
    }

    ll curr_zero = 0, curr_one = 0, zero_sum = 0, ans = one_sum;

    for (auto y_pos : y_cor){
        curr_zero += zero[y_pos];
        curr_one += one[y_pos];

        // cout << y_pos << ' ' << curr_zero << ' ' << curr_one << ' ' << curr_zero + one_sum - curr_one <<  '\n';
        ans = max(ans, curr_zero + one_sum - curr_one);
    }

    return ans;
}

Compilation message

fish.cpp: In function 'll max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:35:37: warning: unused variable 'zero_sum' [-Wunused-variable]
   35 |     ll curr_zero = 0, curr_one = 0, zero_sum = 0, ans = one_sum;
      |                                     ^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 138 ms 16076 KB Output is correct
2 Correct 159 ms 19860 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 312 ms 24540 KB Output is correct
6 Incorrect 284 ms 23656 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 236 ms 19492 KB Output is correct
3 Correct 289 ms 22116 KB Output is correct
4 Correct 108 ms 15964 KB Output is correct
5 Correct 148 ms 19964 KB Output is correct
6 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 14 ms 1584 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 1 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 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 14 ms 1584 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 138 ms 16076 KB Output is correct
2 Correct 159 ms 19860 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 312 ms 24540 KB Output is correct
6 Incorrect 284 ms 23656 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -