Submission #629844

# Submission time Handle Problem Language Result Execution time Memory
629844 2022-08-15T09:06:34 Z europium Catfish Farm (IOI22_fish) C++17
0 / 100
282 ms 24544 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 = 0;

    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 = 0;
      |                                     ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 108 ms 16012 KB Output is correct
2 Correct 169 ms 19864 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 282 ms 24544 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '149814344046482'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 244 ms 19408 KB Output is correct
3 Correct 278 ms 22240 KB Output is correct
4 Correct 106 ms 16076 KB Output is correct
5 Correct 148 ms 19860 KB Output is correct
6 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Correct 108 ms 16012 KB Output is correct
2 Correct 169 ms 19864 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 282 ms 24544 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '149814344046482'
6 Halted 0 ms 0 KB -