# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
839925 |
2023-08-30T21:12:56 Z |
Alihan_8 |
Cave (IOI13_cave) |
C++17 |
|
104 ms |
456 KB |
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
using i64 = long long;
template <typename _F, typename _S>
bool chmax(_F &u, const _S &v){
bool flag = false;
if ( u < v ){
u = v;
flag = true;
}
return flag;
}
template <typename _F, typename _S>
bool chmin(_F &u, const _S &v){
bool flag = false;
if ( u > v ){
u = v;
flag = true;
}
return flag;
}
void exploreCave(int n) {
int ans[n], p[n], used[n];
memset(ans, 0, sizeof(ans));
memset(used, false, sizeof(used));
for ( int i = 0; i < n; i++ ){
vector <int> a;
for ( int j = 0; j < n; j++ ){
if ( !used[j]){
a.pb(j);
}
}
int m = (int)a.size(), l = 0, r = m - 1;
int a_l = tryCombination(ans);
bool flag = false;
while ( l <= r ){
int md = (l + r) >> 1;
for ( int i = l; i <= md; i++ ) ans[a[i]] = 1;
int a_r = tryCombination(ans);
for ( int i = l; i <= md; i++ ) ans[a[i]] = 0;
if ( a_l == a_r ) l = md + 1;
else{
if ( l == md ){
flag = a_l < a_r;
break;
}
else r = md;
}
}
l = a[l];
ans[l] = flag;
p[l] = i;
used[l] = true;
}
answer(ans, p);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
104 ms |
412 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
96 ms |
456 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
104 ms |
412 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |