# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105228 | 2019-04-11T03:25:23 Z | TuGSGeReL | Friend (IOI14_friend) | C++14 | 4 ms | 560 KB |
#include "friend.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define mp make_pair #define pub push_back #define pob pop_back() #define ss second #define ff first #define mt make_tuple #define pof pop_front() #define fbo find_by_order #define ook order_of_key typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; using pll = pair <ll, ll>; using pii = pair <int, int>; int used[10]; vector <int> edg[11]; int findSample(int n,int confidence[],int host[],int protocol[]){ int ans = 0; for (int i = 0; i < n; i++) { if ( protocol[i] == 0 ) { edg[i + 1].pub(host[i]); edg[host[i]].pub(i + 1); } else if ( protocol[i] == 1 ) { for (int j = 0; j < edg[host[i]].size(); j++) { edg[edg[host[i]][j]].pub(i + 1); edg[i + 1].pub(edg[host[i]][j]); } } else { for (int j = 0; j < edg[host[i]].size(); j++) { edg[i + 1].pub(edg[host[i]][j]); edg[edg[host[i]][j]].pub(i + 1); } edg[i + 1].pub(host[i]); edg[host[i]].pub(i + 1); } } for (int i = 0; i < (1 << n); i++) { memset(used, 0, sizeof used); bool boo = 0; int res = 0; for (int j = 0; j < n; j++) { if ( i & (1 << j) ) { for ( auto x : edg[j] ) { if ( used[x] ) { boo = 1; break; } } res += confidence[j]; used[j] = 1; } } if ( !boo ) ans = max(ans, res); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 560 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Incorrect | 3 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |