이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
template<class T>
bool operator()(T const &a, T const &b) const { return a > b; }
};
int n;
map<string,int>gg;
void exploreCave(int n)
{
int tab[n]={0};
int visited[5001];
int pos[5001];
memset(visited,-1,sizeof visited);
int high=n;
int low=0;
int k = 0;
int ans1=0,ans2=0;
for (int i = 0; i < n; ++i)
{
high=n-1;
int kom = tryCombination(tab);
if(kom>i || kom==-1)kom=0;else kom=1;
low=0;
while(high!=low)
{
/*string kali;
if(high == low && visited[low]==-1)
{
//debug(low);
tab[high]=1;
ans2 = tryCombination(tab);
tab[low]=0;
ans1 = tryCombination(tab);
break;
}
else if(high==low){/*debug(low);break;}*/
// debugs(high,low);
int mid=((high+low)/2)+1;
for (int i = mid; i <= high; ++i)
{
if(visited[i]==-1)
{tab[i]=1;}
else {tab[i]=pos[i];}
}
//debug(kali);
/*if(gg.find(kali)!=gg.end())ans1=gg[kali];
else gg[kali]=tryCombination(tab);
ans1=gg[kali];*/
ans1=tryCombination(tab);
if(ans1>i || ans1==-1)ans1=0;else ans1=1;
//kali.clear();
//debugs(mid,high);
for (int i = mid; i <= high; ++i)
{
//debugs(i,visited[i]);
if(visited[i]==-1)
tab[i]=0;
else {tab[i]=pos[i];}
}
if(ans1!=kom)high=mid-1;
else low=mid;
/*debug(kali);
if(gg.find(kali)!=gg.end())ans2=gg[kali];
else gg[kali]=tryCombination(tab);
ans2=gg[kali];*/
//ans2=tryCombination(tab);
}
// if(ans1==-1)ans1=n;
//if(ans2==-1)ans2=n;
//debugs(low,min(ans1,ans2));
//visited[low]=min(ans2,ans1);
tab[low]=pos[low]=i;
visited[low]=kom;
//k++;
}
answer(pos,visited);
return;
}
컴파일 시 표준 에러 (stderr) 메시지
cave.cpp:47:24: warning: "/*" within comment [-Wcomment]
else if(high==low){/*debug(low);break;}*/
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:27:7: warning: unused variable 'k' [-Wunused-variable]
int k = 0;
^
cave.cpp:28:14: warning: unused variable 'ans2' [-Wunused-variable]
int ans1=0,ans2=0;
^~~~
# | 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... |