mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 15:08:52 +00:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -51,9 +51,9 @@ double exotic_arguments_struct_large_ugly(large_ugly a, int nonce) {
|
||||
}
|
||||
|
||||
float exotic_arguments_float(float a, int nonce) {
|
||||
return a + (float) nonce;
|
||||
return a + (float)nonce;
|
||||
}
|
||||
|
||||
double exotic_arguments_double(double a, int nonce) {
|
||||
return a + (double) nonce;
|
||||
return a + (double)nonce;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ int graph_weight[1000][1000];
|
||||
int graph_dijkstra_dist[1000];
|
||||
int graph_dijkstra_visited[1000];
|
||||
|
||||
void graph_weight_init(int n, int nonce, int *x, int (*weight)[1000]) {
|
||||
void graph_weight_init(int n, int nonce, int* x, int (*weight)[1000]) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
weight[i][i] = 0;
|
||||
|
||||
@@ -52,15 +52,17 @@ int graph_dijkstra(int n, int nonce) {
|
||||
graph_dijkstra_visited[v] = 1;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (graph_dijkstra_visited[i]) continue;
|
||||
if (graph_dijkstra_dist[i] != -1 && graph_dijkstra_dist[i] < dist + graph_weight[v][i]) continue;
|
||||
if (graph_dijkstra_visited[i])
|
||||
continue;
|
||||
if (graph_dijkstra_dist[i] != -1 && graph_dijkstra_dist[i] < dist + graph_weight[v][i])
|
||||
continue;
|
||||
graph_dijkstra_dist[i] = dist + graph_weight[v][i];
|
||||
}
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
result += graph_dijkstra_dist[i];
|
||||
result ^= graph_dijkstra_dist[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -76,12 +78,15 @@ int graph_floyd_warshall(int n, int nonce) {
|
||||
|
||||
for (int k = 0; k < n; ++k) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (graph_weight[i][k] == -1) continue;
|
||||
if (graph_weight[i][k] == -1)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < n; ++j) {
|
||||
if (graph_weight[k][j] == -1) continue;
|
||||
if (graph_weight[k][j] == -1)
|
||||
continue;
|
||||
int weight = graph_weight[i][k] + graph_weight[k][j];
|
||||
if (graph_weight[i][j] != -1 && graph_weight[i][j] < weight) continue;
|
||||
if (graph_weight[i][j] != -1 && graph_weight[i][j] < weight)
|
||||
continue;
|
||||
graph_weight[i][j] = weight;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +95,7 @@ int graph_floyd_warshall(int n, int nonce) {
|
||||
int result = 0;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
result += graph_weight[i][j];
|
||||
result ^= graph_weight[i][j];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -2,7 +2,7 @@ int matrix_a[30][30];
|
||||
int matrix_b[30][30];
|
||||
int matrix_c[30][30];
|
||||
|
||||
void matrix_init(int n, int nonce, int *x, int (*matrix)[30]) {
|
||||
void matrix_init(int n, int nonce, int* x, int (*matrix)[30]) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
matrix[i][j] = ++*x;
|
||||
@@ -30,7 +30,7 @@ int matrix_mul(int n, int nonce) {
|
||||
for (int k = 0; k < n; ++k) {
|
||||
matrix_c[i][j] += matrix_a[i][k] * matrix_b[k][j];
|
||||
}
|
||||
result += matrix_c[i][j];
|
||||
result ^= matrix_c[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ int matrix_add(int n, int nonce) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
matrix_c[i][j] = matrix_a[i][j] + nonce * matrix_b[i][j];
|
||||
result += matrix_c[i][j];
|
||||
result ^= matrix_c[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ int verify_median(int n, int* test) {
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
int v = test[i];
|
||||
result += v;
|
||||
result ^= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -14,8 +14,8 @@ void multiply_data_init(int nonce) {
|
||||
int y = nonce;
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
x = (x * 97 + 17) % 10009;
|
||||
y = (y * 17 + 23) % 10007;
|
||||
x = (x * 97 + 17) % 1009;
|
||||
y = (y * 17 + 23) % 1007;
|
||||
input1_multiply[i] = x;
|
||||
input2_multiply[i] = y;
|
||||
}
|
||||
@@ -26,6 +26,9 @@ int multiply(int x, int y) {
|
||||
int result = 0;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (x == 0)
|
||||
break;
|
||||
|
||||
if ((x & 0x1) == 1)
|
||||
result = result + y;
|
||||
|
||||
@@ -47,7 +50,7 @@ int verify_multiply(int n, int* test) {
|
||||
if (t0 * t1 != v)
|
||||
return 1;
|
||||
|
||||
result += v;
|
||||
result ^= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -12,7 +12,7 @@ void qsort_data_init(int nonce) {
|
||||
int x = nonce;
|
||||
|
||||
for (i = 0; i < 16384; i++) {
|
||||
x = (x * 97 + 17) % 100000009;
|
||||
x = (x * 97 + 17) % 100009;
|
||||
input_qsort_data[i] = x;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ int verify_qsort(int n, int* test) {
|
||||
if (t0 > t1)
|
||||
return 1;
|
||||
|
||||
result += t0;
|
||||
result ^= t0;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -12,7 +12,7 @@ void rsort_data_init(int nonce) {
|
||||
int x = nonce;
|
||||
|
||||
for (i = 0; i < 2048; i++) {
|
||||
x = (x * 97 + 17) % 10000007;
|
||||
x = (x * 97 + 17) % 100007;
|
||||
input_rsort_data[i] = x;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ int verify_rsort(int n, int* test) {
|
||||
if (t0 > t1)
|
||||
return 1;
|
||||
|
||||
result += t0;
|
||||
result ^= t0;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -74,7 +74,7 @@ int verifyDouble(int n, double* test) {
|
||||
int result = 0;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
result += (int) (test[i]);
|
||||
result ^= (int) (test[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -11,7 +11,7 @@ int two_dimension_array(int n, int nonce) {
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
two_dimension_array_arr[i] += two_dimension_array_arr[j];
|
||||
two_dimension_array_arr[i] ^= two_dimension_array_arr[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ int verify_vvadd(int n, int* test) {
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
int v = test[i];
|
||||
result += v;
|
||||
result ^= v;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user