제출 #949820

#제출 시각아이디문제언어결과실행 시간메모리
949820emad234동굴 (IOI13_cave)C++17
100 / 100
1000 ms604 KiB
#include "cave.h" #include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<int,int> const int mod = 1e9 + 7; const int mxN = 2e5 + 5; using namespace std; int tryCombination(int S[]); void answer(int S[], int D[]); void exploreCave(int N); void exploreCave(int N) { const int sz = N; int s[sz],d[sz]; int gv[sz]; memset(s,-1,sizeof s); for(int i = 0;i < N;i++){ bool chk = 0; for(int j = 0;j < N;j++){ gv[j] = s[j] != -1 ? s[j] : chk; } if(tryCombination(gv) == i) chk = 1; int l = 0,r = N - 1; while(l < r){ int md = (l + r) / 2; for(int j = 0;j < N;j++) gv[j] = s[j] != -1 ? s[j] : !chk; for(int j = l;j <= md;j++) gv[j] = s[j] != -1 ? s[j] : chk; if(tryCombination(gv) == i){ l = md + 1; }else{ r = md; } } s[l] = chk; d[l] = i; } answer(s,d); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...