# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
138382 |
2019-07-29T20:28:46 Z |
Nucleist |
Friend (IOI14_friend) |
C++14 |
|
3 ms |
432 KB |
#include <bits/stdc++.h>
#include "friend.h"
using namespace std;
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
template<class T>
bool operator()(T const &a, T const &b) const { return a > b; }
};
int weight[12];
int visited[13];
vector<int>adj[1001];
int dal;
int solve(int node)
{
if(node>=dal){/*debug("fin");*/return 0;}
int ans = 0;
if(!visited[node])
{
visited[node]++;
for (int i = 0; i < adj[node].size(); ++i)
{
int next = adj[node][i];
visited[next]++;
}
ans=max(ans,solve(node+1)+weight[node]);
//debugs(node,ans);
for (int i = 0; i < adj[node].size(); ++i)
{
int next = adj[node][i];
visited[next]--;
}
visited[node]--;
}
ans = max(ans,solve(node+1));
return ans;
}
int findSample(int n,int confidence[],int host[],int protocol[])
{
dal = n;
int kal = 0;
for (int i = 0; i < n; ++i)
{
weight[i]=confidence[i];
kal+=weight[i];
}
return kal;
}
//code the AC sol !
// BS/queue/map
Compilation message
friend.cpp: In function 'int solve(int)':
friend.cpp:28:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < adj[node].size(); ++i)
~~^~~~~~~~~~~~~~~~~~
friend.cpp:35:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < adj[node].size(); ++i)
~~^~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
380 KB |
Output is correct |
7 |
Correct |
2 ms |
432 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |