#include <iostream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
#define lint long long
#define pb push_back
#define mp make_pair
using namespace std;
lint MOD = 1e9 + 7;
int INF = 1e9;
void solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr){
vector<vector<int>> v(3, vector<int>(3, 0));
v[0][0] = 0;
v[1][1] = 0;
v[2][2] = 0;
// for(auto i : c){cout << i << " ";}
for(int i = 0; i < M; i ++){
v[x[i]][y[i]] = c[i];
v[y[i]][x[i]] = c[i];
}
// for(int i = 0; i < 3; i ++){
// for(int j = 0; j < 3; j ++){
// cout << v[i][j] << " ";
// }
// cout << endl;
// }
int sum1 = 0; // v[0][H]
if(arr[H] == 0){sum1 = 0;}
if(arr[H] == 1){sum1 += v[0][H];}
if(arr[H] == 2){sum1 += v[0][H]/2;}
// cout << c[H] << "sum1=" << sum1 << "\n\n\n";
int sum2 = 0; // v[0][3-H]+v[3-H][H]
if(arr[3-H] == 0){sum2 = 0;}
if(arr[3-H] == 1){sum2 += v[0][3-H];}
if(arr[3-H] == 2){sum2 += v[0][3-H]/2;}
if(arr[H] == 0){sum2 = 0;}
if(arr[H] == 1){sum2 += v[3-H][H];}
if(arr[H] == 2){sum2 += v[3-H][H]; sum2 /= 2;}
// cout << sum1 << " " << sum2 << endl << endl;
if(v[0][H] == 0) cout << sum2;
else if(v[0][3-H] == 0 || v[3-H][H] == 0){cout << sum1;}
else cout << min(sum1, sum2);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
856 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
18 ms |
5616 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
712 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |