#include "fish.h"
// author : sentheta aka vanwij
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<random>
#include<chrono>
#include<cmath>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define Int long long
#define V vector
#define pii pair<int,int>
#define ff first
#define ss second
#define rand() (uniform_int_distribution<int>(0,1<<30)(rng))
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pow2(x) (1LL<<(x))
#define msb(x) (63-__builtin_clzll(x))
#define bitcnt(x) (__builtin_popcountll(x))
#define nl '\n'
#define _ << ' ' <<
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define dbg(x) if(1) cout << "?" << #x << " : " << (x) << endl << flush;
const Int N = 2e5+5;
Int n, m;
V<Int> x, y, w;
Int c[N];
Int dp[N][2][2];
Int max_weights(int _n,int _m,V<int> _x,V<int> _y,V<int> _w){
n = _n; m = _m;
x = V<Int>(all(_x)); y = V<Int>(all(_y)); w = V<Int>(all(_w));
rep(i,0,m){
// dbg(x[i]);
c[x[i]] = w[i];
}
rep(i,1,n){
rep(p,0,2) rep(q,0,2) rep(r,0,2){
Int cost = dp[i-1][p][q];
if(!p && !q && r){
cost += c[i-1];
}
if(q && !r){
cost += c[i];
}
dp[i][q][r] = max(dp[i][q][r], cost);
}
}
// dbg(dp[1][0][0]);
// dbg(dp[1][0][1]);
// dbg(dp[1][1][0]);
// dbg(dp[1][1][1]);
Int ans = 0;
rep(p,0,2) rep(q,0,2){
ans = max(ans, dp[n-1][p][q]);
}
return ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
7328 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
316 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3384 KB |
Output is correct |
2 |
Correct |
3 ms |
3412 KB |
Output is correct |
3 |
Correct |
20 ms |
6764 KB |
Output is correct |
4 |
Correct |
15 ms |
6092 KB |
Output is correct |
5 |
Correct |
32 ms |
9416 KB |
Output is correct |
6 |
Correct |
26 ms |
9800 KB |
Output is correct |
7 |
Correct |
33 ms |
10444 KB |
Output is correct |
8 |
Correct |
35 ms |
10428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3384 KB |
Output is correct |
2 |
Correct |
3 ms |
3412 KB |
Output is correct |
3 |
Correct |
20 ms |
6764 KB |
Output is correct |
4 |
Correct |
15 ms |
6092 KB |
Output is correct |
5 |
Correct |
32 ms |
9416 KB |
Output is correct |
6 |
Correct |
26 ms |
9800 KB |
Output is correct |
7 |
Correct |
33 ms |
10444 KB |
Output is correct |
8 |
Correct |
35 ms |
10428 KB |
Output is correct |
9 |
Incorrect |
36 ms |
10172 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
7328 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |