Submission #101896

#TimeUsernameProblemLanguageResultExecution timeMemory
101896eriksuenderhaufFriend (IOI14_friend)C++11
100 / 100
34 ms2680 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> #include "friend.h" //#include "grader.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define enl printf("\n") #define case(t) printf("Case #%d: ", (t)) #define ni(n) scanf("%d", &(n)) #define nl(n) scanf("%I64d", &(n)) #define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i]) #define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i]) #define pri(n) printf("%d\n", (n)) #define prl(n) printf("%I64d\n", (n)) #define pii pair<int, int> #define pll pair<long long, long long> #define vii vector<pii> #define vi vector<int> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef cc_hash_table<int,int,hash<int>> ht; const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 2e6 + 5; const double eps = 1e-9; int findSample(int n, int confidence[], int host[], int protocol[]) { int ans = 0; for (int i = n - 1; i >= 0; i--) { if (protocol[i] == 0) { ans += confidence[i]; confidence[host[i]] = max(confidence[host[i]] - confidence[i], 0); } else if (protocol[i] == 1) { confidence[host[i]] += confidence[i]; } else { confidence[host[i]] = max(confidence[host[i]], confidence[i]); } } return confidence[0] + ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...