#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
long long int Graph[400][12]={{0}};
long long int dp[12][12]={{0}};
long long int tmp[12][12]={{0}};
long long int Count(long long int n,long long int m,long long int column){
long long int answer=0;
for(long long int i=n;i<=m;i++){
answer+=Graph[column][i];
}
return answer;
}
/*
void check(){
cout<<endl;
for(int i=0;i<12;i++){
for(int j=0;j<12;j++){
cout<<dp[i][j]<<" ";
}
cout<<endl;
}
}
*/
long long int max_weights(int N,int M,vector<int> x,vector<int> y,vector<int> w){
for(long long int i=0;i<M;i++){
Graph[x[i]][y[i]+1]=w[i];
}
for(long long int i=0;i<12;i++){
for(long long int j=0;j<12;j++){
dp[i][j]=Count(i,j,0);
tmp[i][j]=0;
}
}
//check();
for(long long int Time=1;Time<N-1;Time++){
for(long long int j=0;j<12;j++){
for(long long int k=0;k<12;k++){
for(long long int i=0;i<12;i++){
tmp[j][k]=max(tmp[j][k],dp[i][j]+Count(j,max(k,i),Time));
}
}
}
for(long long int j=0;j<12;j++){
for(long long int k=0;k<12;k++){
dp[j][k]=tmp[j][k];
tmp[j][k]=0;
}
}
//check();
}
long long int Final=0;
for(long long int j=0;j<12;j++){
for(long long int k=0;k<12;k++){
dp[j][k]+=Count(k,j,N-1);
Final=max(Final,dp[j][k]);
}
}
//check();
return Final;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
22 ms |
4248 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
47 ms |
8104 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
2 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '220242990393' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
2 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '220242990393' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
2 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '220242990393' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
22 ms |
4248 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |