# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
839916 |
2023-08-30T21:01:11 Z |
Alihan_8 |
Cave (IOI13_cave) |
C++17 |
|
2 ms |
596 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];
memset(ans, -1, sizeof(ans));
for ( int i = 0; i < n; i++ ){
vector <int> a;
for ( int j = 0; j < n; j++ ){
if ( ans[j] == -1 ){
a.pb(j);
}
}
int m = (int)a.size(), l = 0, r = m - 1;
bool flag = false;
while ( l <= r ){
int md = (l + r) >> 1;
auto L = ans, R = ans;
for ( int i = l; i <= md; i++ ) L[a[i]] = 0;
for ( int i = l; i <= md; i++ ) R[a[i]] = 1;
for ( int i = 0; i < n; i++ ){
chmax(L[i], 0);
chmax(R[i], 0);
}
int a_l = tryCombination(L), a_r = tryCombination(R);
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;
}
answer(ans, p);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
596 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |