Submission #819805

#TimeUsernameProblemLanguageResultExecution timeMemory
819805Cyber_WolfFriend (IOI14_friend)C++17
0 / 100
6 ms9808 KiB
#include <bits/stdc++.h> #include "friend.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast") using namespace std; using namespace __gnu_pbds; #define lg long long #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const lg N = 2e5+5; lg par[N]; vector<set<lg>> adj(N); lg get(lg src) { if(src == par[src]) return src; return par[src] = get(par[src]); } void join(lg u, lg v) { par[u] = v; return; } int findSample(int n, int c[], int h[], int p[]) { int ans = c[0]; // for(int i = 1; i < n; i++) // { // h[i]++; // } for(int i = 1; i < n; i++) { if(h[i]) ans += c[i]; } for(int i = 1; i < n; i++) { int sum = c[i]; for(int j = i-1; j >= 0; j--) { if(j == h[i]) continue; // cout << j << ' '; sum += c[j]; } for(int j = i+1; j < n; j++) { if(h[j] == i) continue; // cout << j << ' '; sum += c[j]; } // cout << ans << '\n'; ans = max(ans, sum); } return 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...