# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
962656 | danikoynov | 동굴 (IOI13_cave) | C++14 | 689 ms | 868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5010;
int used[maxn], s[maxn], d[maxn], b[maxn];
int arr[maxn];
int try_comb(vector < int > v)
{
for (int i = 0; i < v.size(); i ++)
arr[i] = v[i];
return tryCombination(arr);
}
void exploreCave(int N)
{
for (int pos = 0; pos < N; pos ++)
{
vector < int > comb;
int bit = 0;
for (int i = 0; i < N; i ++)
{
if (!used[i])
comb.push_back(bit);
else
comb.push_back(b[i]);
}
int door = try_comb(comb);
if (door != -1 && door <= pos)
bit ^= 1;
///cout << bit << endl;
comb.clear();
int lf = 0, rf = N - 1;
while(lf <= rf)
{
int mf = (lf + rf) / 2;
comb.clear();
for (int i = 0; i <= mf; i ++)
{
if (!used[i])
comb.push_back(bit);
else
comb.push_back(b[i]);
}
for (int i = mf + 1; i < N; i ++)
{
if (!used[i])
comb.push_back(bit ^ 1);
else
comb.push_back(b[i]);
}
int ret = try_comb(comb);
/**for (int i = 0; i < comb.size(); i ++)
cout << comb[i] << " ";
cout << endl;
cout << "ret " << ret << endl;*/
if (ret != -1 && ret <= pos)
lf = mf + 1;
else
rf = mf - 1;
}
used[lf] = 1;
s[lf] = pos;
b[lf] = bit;
//cout << "found " << lf << " " << bit << " " << pos << endl;
}
/**for (int i = 0; i < N; i ++)
{
cout << b[i] << " ";
}
cout << endl;
for (int i = 0; i < N; i ++)
{
cout << s[i] << " ";
}
cout << endl;*/
answer(b, s);
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |