이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<cave.h>
using namespace std;
int result[5002],match[5002],sent[5002];
bool iflastopen,fixed_[5002];
int N;
void change(int a, int b, bool c){
for(int i=a;i<=b;i++){
if(!fixed_[i])
sent[i]= c;
}
}
void exploreCave(int n){
N = n;
for(int j=0;j<n;j++){
change(0,n-1,0);
int p=tryCombination(sent);
if(!p==j)
iflastopen=0;
else
iflastopen=1;
int pocz=0;
int kon=n-1;
while(pocz!=kon){
int sr=(pocz+kon)/2;
change(pocz,sr,iflastopen);
change(sr+1,kon,!iflastopen);
int ak=tryCombination(sent);
if(!p==j)
{
kon=sr;
}
else{
pocz=sr+1;
}
}
sent[pocz] = iflastopen;
match[j]=pocz;
fixed_[pocz]=1;
}
answer(sent,match);
}
컴파일 시 표준 에러 (stderr) 메시지
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:14: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
19 | if(!p==j)
| ^~
cave.cpp:19:12: note: add parentheses around left hand side expression to silence this warning
19 | if(!p==j)
| ^~
| ( )
cave.cpp:30:18: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
30 | if(!p==j)
| ^~
cave.cpp:30:16: note: add parentheses around left hand side expression to silence this warning
30 | if(!p==j)
| ^~
| ( )
cave.cpp:29:17: warning: unused variable 'ak' [-Wunused-variable]
29 | int ak=tryCombination(sent);
| ^~
# | 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... |