이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <iomanip>
#include <deque>
#include <cassert>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <chrono>
#include <ctime>
#include <random>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <iterator>
#include <climits>
#include "cave.h"
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
#define INF 2001001001
#define MOD 1000000007
vector<int>ind;
int S[5001],D[5001];
void exploreCave(int N){
for (int i=0;i<N;i++){
S[i]=-1; D[i]=-1;
ind.push_back(i);
}
for (int i=0;i<N;i++){ //figuring out door i now
int v[5001];
fill(v,v+N,1);
for (int j=0;j<N;j++)
if (S[j]!=-1)
v[j]=D[j];
int r=tryCombination(v);
if (r==-1) r=INF;
bool state;
if (r>i)
state=true;
else
state=false;
int low=0,high=ind.size()-1,mid;
while (low<high){
mid=(low+high)/2;
int q[5001];
fill(q,q+N,0);
for (int j=low;j<=mid;j++)
q[ind[j]]=1;
for (int j=0;j<N;j++)
if (S[j]!=-1)
q[j]=D[j];
int res=tryCombination(q);
if (res==-1) res=INF;
if (res>i){
if (state)
high=mid;
else
low=mid+1;
}
else{
if (state)
low=mid+1;
else
high=mid;
}
}
S[ind[low]]=i;
D[ind[low]]=state;
ind.erase(ind.begin()+low);
}
answer(D,S);
}
# | 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... |