이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
int s[5009], d[5009];
int done[5009];
int fin = 0;
void exploreCave(int N) {
srand(time(NULL));
vector<int> v;
for(int i = 0; i < N; ++i){
s[i] = rand()%2;
v.pb(i);
}
int cur = tryCombination(s);
if(cur == -1)
cur = 1e9+7;
while(fin < N){
//cout << fin << '\n';
random_shuffle(all(v));
for(auto u : v){
if(done[u])
continue;
s[u] ^= 1;
int newcur = tryCombination(s);
if(newcur == -1)
newcur = 1e9+7;
if(newcur < cur){
s[u] ^= 1;
done[u] = 1;
d[u] = newcur;
++fin;
}
else if(newcur > cur){
done[u] = 1;
d[u] = cur;
cur = newcur;
++fin;
}
}
}
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... |