/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#include "friend.h"
/*#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
template<class T>
using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
/**/
//typedef int ll;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 vll;
typedef unsigned __int128 uvll;
ll _i=0;
#define ffn(x) _i=x
#define llll std::pair<ll , ll>
#define stitr set<ll>::iterator
#define fora(y,x) for(ll y=_i;x>y;y++)
#define pb push_back
#define pf push_front
#define halo cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 998244353;
const ll ous = 1e5 + 7;
const ll dx[4] = {1 , 0 , 0 , -1} , dy[4] = {0,1,-1,0};
ll p[ous] , f[ous];
int findSample(int n , int con[] , int host[] , int op[]){
fora(i , n){
p[i] = con[i];
}
for(ll i = n-1;0 < i;i--){
ll x = host[i];
if(op[i] == 2){
p[x] = std::max(p[x] + f[i] ,p[i] + f[x]);
f[x]+= f[i];
}
else if(op[i] == 0){
f[x] += std::max(f[i] , p[i]);
p[x] += f[i];
}
else{
p[x] = std::max({p[x] + f[i] , f[x] + p[i] , p[x] + p[i]});
f[x] = f[i];
}
}
}
Compilation message
friend.cpp:13:1: warning: "/*" within comment [-Wcomment]
13 | /**/
|
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
53 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
436 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
436 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
436 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |