Submission #253229

# Submission time Handle Problem Language Result Execution time Memory
253229 2020-07-27T13:54:00 Z aZvezda Friend (IOI14_friend) C++14
0 / 100
1 ms 512 KB
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

// Find out best sample

const int MAX_N = 1e6 + 10;
int dp[MAX_N];

int findSample(int n, int confidence[], int host[], int protocol[]){
    int ans = 0;
    for(int i = 0; i < n; i ++) {
        dp[i] = confidence[i];
    }
    for(int i = n - 1; i > 0; i --) {
        if(protocol[i] == 1) {
            dp[host[i]] -= min(dp[i], dp[host[i]]);
            ans += dp[i];
        } else if(protocol[i] == 2) {
            dp[host[i]] += dp[i];
        } else {
            chkmin(dp[host[i]], dp[i]);
        }
    }
	return ans + dp[0];
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -