#include <bits/stdc++.h>
using namespace std;
struct keliai{
int start;
int end;
int profit;
};
int main()
{
int n, m, maks=0;
cin >> n >> m;
keliai kelias[m];
for (int i=0;i<m;i++){
cin >> kelias[i].start >> kelias[i].end >> kelias[i].profit;
}
for (int j=0;j<n;j++){
int tmaks=0;
for (int i=0;i<m;i++){
if(j==kelias[i].start||j==kelias[i].end)tmaks+=kelias[i].profit;
}
maks=max(tmaks, maks);
}
cout << maks;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
268 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
268 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3014 ms |
4196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3014 ms |
4196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |