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 <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
#define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
using ll = long long;
int mod = (ll)1e9 + 7;
#define PI acos(-1)
typedef pair<int, int> pairs;
const int INF = 1e9 + 1;
const int N = 2e5 + 100;
const double eps = 1e-7;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <typename XPAX>
void ckma(XPAX &x, XPAX y) {
x = (x < y ? y : x);
}
template <typename XPAX>
void ckmi(XPAX &x, XPAX y) {
x = (x > y ? y : x);
}
void exploreCave(int n) {
/* ... */
int s[n];
int d[n];
set<int> candi;
forn(i, n) candi.insert(i);
memset(s, 0, sizeof(s));
int fs = tryCombination(s);
if(fs == -1) fs = INF;
while(candi.size()) {
auto ls = candi;
for(auto c : ls) {
s[c] ^= 1;
int x = tryCombination(s);
if(x == -1)x = INF;
if(x < fs) {
s[c] ^= 1;
d[c] = x;
candi.erase(c);
}
else if(x > fs) {
d[c] = fs;
swap(x, fs);
candi.erase(c);
}
else {
s[c] ^= 1;
}
}
}
forn(i, n) s[i] ^= 1;
answer(s, d);
}
# | 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... |