#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
int Graph[302][10]={{0}};
long long int dp[10][10]={{0}};
long long int tmp[10][10]={{0}};
long long int Count(int n,int m,int column){
long long int answer=0;
for(int i=n;i<=m;i++){
answer+=Graph[column][i];
}
return answer;
}
void check(){
cout<<endl;
for(int i=0;i<9;i++){
for(int j=0;j<9;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(int i=0;i<M;i++){
Graph[x[i]][y[i]]=w[i];
}
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
dp[i][j]=Count(i,j,0);
}
}
//check();
for(int Time=1;Time<N-1;Time++){
for(int j=0;j<10;j++){
for(int k=0;k<10;k++){
for(int i=0;i<10;i++){
tmp[j][k]=max(tmp[j][k],dp[i][j]+Count(j,max(k,i),Time));
}
}
}
for(int j=0;j<10;j++){
for(int k=0;k<10;k++){
dp[j][k]=tmp[j][k];
tmp[j][k]=0;
}
}
//check();
}
long long int Final=0;
for(int j=0;j<10;j++){
for(int k=0;k<10;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 |
4260 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 |
4 ms |
340 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 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Incorrect |
1 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Incorrect |
1 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Incorrect |
1 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 |
4 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 |
4260 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |