Submission #1026354

# Submission time Handle Problem Language Result Execution time Memory
1026354 2024-07-18T02:21:42 Z Mardonbekhazratov Catfish Farm (IOI22_fish) C++17
3 / 100
82 ms 10856 KB
#include "fish.h"

#include <iostream>
#include <vector>
#include <tuple>
#include <set>
#include <map>

using namespace std;
#define ll long long

int n,m;
vector<int>x,y,w;
ll ans=0;

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    tie(n,m,x,y,w)=tie(N,M,X,Y,W);
    bool su1=true,su2=true;
    for(int i=0;i<m;i++){
        if(x[i]%2==1) su1=false;
        if(x[i]>1) su2=false;
    }
    if(su1){for(int i=0;i<m;i++) ans+=w[i];return ans;}
    if(su2){
        set<pair<int,int>>s;
        map<int,int>id;
        for(int i=0;i<m;i++){
            s.insert({x[i],y[i]});
            if(x[i]==1) id[y[i]]=1;
        }
        for(int i=0;i<m;i++){
            if(x[i]==0 && s.find({1,y[i]})!=s.end()){
                ans+=max(w[i],w[id[y[i]]]);
            }
        }
        return ans;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 15 ms 3160 KB Output is correct
2 Correct 17 ms 3928 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 57 ms 10856 KB Output is correct
6 Correct 82 ms 10856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 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 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 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 15 ms 3160 KB Output is correct
2 Correct 17 ms 3928 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 57 ms 10856 KB Output is correct
6 Correct 82 ms 10856 KB Output is correct
7 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '0'
8 Halted 0 ms 0 KB -