mirror of
https://github.com/appinfosapienza/so-un-bot.git
synced 2025-03-14 13:06:14 +01:00
14 lines
No EOL
444 B
Text
14 lines
No EOL
444 B
Text
#define n 1000
|
|
int TestOracle1(int *A, int *B)
|
|
{
|
|
int i, j, D[n];
|
|
//init
|
|
for (i = 0; i < n; i++) D[i] = -1;
|
|
// B is ordered
|
|
for (i = 0; i < n; i++) { for (j = i+1; j < n; j++) {if (B[j] < B[i]) {retun (0);}}}
|
|
// B is a permutation of A
|
|
for (i = 0; i < n; i++) { for (j = 0; j < n; j++) {if ((A[i] == B[j]) && (D[j] == -1)) {C[i][j] = 1; D[j] = 1; break;}
|
|
for (i = 0; i < n; i++) {if (D[i] == -1) return (0);}
|
|
// B ok
|
|
return (1);
|
|
} |