This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
// #include <stdio.h>
// #include <stdlib.h>
// #define MAX_N 5000
// #define MAX_CALLS 70000
// /* Symbol obfuscation */
// #define NN koala
// #define realS kangaroo
// #define realD possum
// #define inv platypus
// #define num_calls echidna
// static int NN;
// static int realS[MAX_N];
// static int realD[MAX_N];
// static int inv[MAX_N];
// static int num_calls;
// void answer(int S[], int D[]) {
// int i;
// int correct = 1;
// for (i = 0; i < NN; ++i)
// if (S[i] != realS[i] || D[i] != realD[i]) {
// correct = 0;
// break;
// }
// if (correct)
// printf("CORRECT\n");
// else
// printf("INCORRECT\n");
// for (i = 0; i < NN; ++i) {
// if (i > 0)
// printf(" ");
// printf("%d", S[i]);
// }
// printf("\n");
// for (i = 0; i < NN; ++i) {
// if (i > 0)
// printf(" ");
// printf("%d", D[i]);
// }
// printf("\n");
// exit(0);
// }
// int tryCombination(int S[]) {
// int i;
// if (num_calls >= MAX_CALLS) {
// printf("INCORRECT\nToo many calls to tryCombination().\n");
// exit(0);
// }
// ++num_calls;
// for (i = 0; i < NN; ++i)
// if (S[inv[i]] != realS[inv[i]])
// return i;
// return -1;
// }
//
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define orta ((bas+son)/2)
#define mod 1000000007
#define LOGN 16
#define N 1000005
using namespace std;
typedef long long ll;
int n, d, ne[N], c[N], s[N], u[N], nee[N], cc[N];
int sor(int x){
for(int i = 0; i < x; i++)
s[c[i]] = ne[i];
int cvp = tryCombination(s);
return (cvp == -1)?n:cvp;
}
void exploreCave(int nn) {n = nn;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++)
s[j] = 0;
int ilk = sor(i);
for(int j = 0; j < n; j++)
s[j] = 1;
int iki = sor(i);
d = (iki > ilk);
ne[i] = d;
int bas = 0, son = n - 1;
while(bas < son){
for(int j = 0; j <= orta; j++)
s[j] = d;
for(int j = orta + 1; j < n; j++)
s[j] = 1 - d;
if(sor(i) > i)
son = orta;
else
bas = orta + 1;
}
c[i] = orta;
}
for(int i = 0; i < n; i++){
cc[c[i]] = i;
nee[c[i]] = ne[i];
}
answer(nee, cc);
}
//
// int init() {
// int i, res;
// FILE *f = fopen("in.txt", "r");
// res = fscanf(f, "%d", &NN);
// for (i = 0; i < NN; ++i) {
// res = fscanf(f, "%d", &realS[i]);
// }
// for (i = 0; i < NN; ++i) {
// res = fscanf(f, "%d", &realD[i]);
// inv[realD[i]] = i;
// }
// num_calls = 0;
// return NN;
// }
// int main() {
// freopen("out.txt", "w", stdout);
// int NN;
// NN = init();
// exploreCave(NN);
// printf("INCORRECT\nYour solution did not call answer().\n");
// return 0;
// }
# | 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... |