이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
double 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) return sum2;
else if(v[0][3-H] == 0 || v[3-H][H] == 0){return sum1;}
else return min(sum1, sum2);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |