# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1277454 | | almaz | 동굴 (IOI13_cave) | C++20 | | 2092 ms | 118572 KiB |
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
// #define int long long
// #define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ar array
const int MOD = 1e9 + 7,INF = 1e9, N = 2e5 + 5;
/*
*/
void exploreCave(int n){
int ans[n], s[n], st[n];
for(int i = 0;i < n;i++){
ans[i] = 0;
st[i] = 0;
s[i] = 0;
}
for(int i = 0;i < n;i++){
int v = 1;
int x = tryCombination(ans);
if(x > i){
v = 0;
for(int i = 0;i < n;i++){
if(st[i]) continue;
ans[i] = 1 - ans[i];
}
x = i;
}
cout<<x<<" x"<<endl;
int l = 0, r = n - 1;
int a = -1;
while(l <= r){
int m = (l + r) >> 1;
cout<<l << ' ' << r <<endl;
for(int i = l;i <= m;i++){
if(st[i]) {
continue;
}
ans[i] = 1 - ans[i];
}
for(int i = 0;i < n;i++){
cout<<ans[i]<<' ';
}
int y = tryCombination(ans);
cout<<y<<" y"<<endl;
for(int i = l;i <= m;i++){
if(st[i]) continue;
ans[i] = 1 - ans[i];
}
if(y > x || y == -1){
r = m - 1;
a = m;
}
else{
l = m + 1;
}
}
cout<<a<<" a"<<endl;
s[a] = i;
st[a] = 1;
ans[a] = v;
cout<<"HERE"<<endl;
for(int i = 0;i < n;i++){
cout << ans[i]<<' ';
}
cout<<endl;
}
int x = tryCombination(ans);
// if(x != -1){
// while(true);
// }
answer(ans, 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... |