이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cave.h"
#define ll int
#define pb push_back
#define eb emplace_back
#define vl vector<ll>
#define fi first
#define se second
#define in insert
#define mpr make_pair
#define lg(x) __lg(x)
#define bpc(x) __builtin_popcount(x)
#define all(v) v.begin(), v.end()
#define endl "\n"
using namespace std;
const int sz = 5005;
bool used[sz];
void exploreCave(int N) {
ll n, i, j, low, high, mid, a1, a2;
ll ans1[n], ans2[n], dub[n];
for(i=0;i<n;i++){
ans1[i] = ans2[i] = dub[i] = 0;
}
bool as = 0;
for(i=0;i<n;i++){
a1 = tryCombination(ans1);
low = 0, high = n-1;
if(a1 == -1){a1 = n;}
if(a1 > i){as = 1;}
else{as = 0;}
while(low < high){
mid = (low + high)>>1;
for(j=0;j<n;j++){
dub[j] = ans1[j];
if(used[j]){continue;}
if(j > mid && j <= high){
dub[j] = 1;
}
}
a2 = tryCombination(dub);
if(a2 == -1){a2 = n;}
if(as && a2 == i){
low = mid + 1;
}
else if(a1 == i && a2 > i){
low = mid + 1;
}
else{
high = mid - 1;
}
}
ans2[low] = i;
if(a1 == i){
ans1[low] = 1 - ans1[low];
}
used[low] = 1;
}
answer(ans1, ans2);
}
컴파일 시 표준 에러 (stderr) 메시지
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:21:14: warning: 'n' is used uninitialized in this function [-Wuninitialized]
21 | ll ans1[n], ans2[n], dub[n];
| ^
# | 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... |