Submission #607475

# Submission time Handle Problem Language Result Execution time Memory
607475 2022-07-26T18:10:26 Z MohamedFaresNebili Friend (IOI14_friend) C++14
0 / 100
1 ms 260 KB
#include <bits/stdc++.h>
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
 
            using namespace std;
 
            using ll = long long;
            using ld = long double;
 
            #define ff first
            #define ss second
            #define pb push_back
            #define all(x) (x).begin(), (x).end()
            #define lb lower_bound
 
            const int MOD = 998244353;
 
            int DP[100001][2];
 
            int findSample(int N, int* confidence,
                          int* host, int* protocol) {
                for(int l = 0; l < N; l++)
                    DP[l][1] = confidence[l];
                for(int l = N - 1; l > 0; l--) {
                    int t = protocol[l];
                    if(t == 0) DP[host[l]][0] += confidence[l];
                    if(t == 1) DP[host[l]][1] += confidence[l];
                    if(t == 2) DP[host[l]][1] = max(DP[host[l]][0] + confidence[l], DP[host[l]][1]);
                  	DP[host[l]][1] = max(DP[host[l]][1], DP[host[l]][0]);
                }
                return min(DP[0][0], DP[0][1]);
            }
            
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 260 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -