# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
962660 |
2024-04-14T06:31:44 Z |
Ice_man |
Cave (IOI13_cave) |
C++14 |
|
0 ms |
0 KB |
/**
____ ____ ____ __________________ ____ ____ ____
||I || ||c || ||e || || || ||M || ||a || ||n ||
||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__||
|/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\|
*/
#include "cave.h"
#include <map>
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include <cstdio>
#define maxn 5005
#define maxn2 205
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cerr<<"passed"<<endl;
#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")
using namespace std;
/**std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;
double timePassed()
{
using namespace std::chrono;
currT = high_resolution_clock::now();
double time = duration_cast<duration<double>>(currT - startT).count();
return time * TIME_MULT;
}*/
typedef pair <int, int> pii;
int a , b , t;
int w[maxn] , s[maxn];
int x[maxn] , y[maxn];
pii pom[maxn];
int used[maxn];
bool help(int m)
{
for(int i = 0; i <= m; i++)
if(used[i] == -1)
used[i] = !used[i];
}
bool up[maxn];
int exploreCave(int N)
{
for(int i = 0; i < n; i++)
{
used[i] = -1;
up[i] = 0;
}
int l , r , mid;
int cur_ans;
for(int i = 0; i < n; i++)
{
if(tryCombination(up) == i)
help(N);
l = 0;
r = n - 1;
cur_ans = -1;
while(l < = r)
{
mid = (l + r) / 2;
help(mid);
int save = tryCombination(up);
help(mid);
if(save == i)
{
r = mid - 1;
cur_ans = mid - 1;
}
else l = mid + 1;
}
used[cur_ans] = i;
}
answer(up , used);
}
/**int main()
{
#ifdef ONLINE_JUDGE /// promeni
freopen("input.in", "r", stdin);
freopen("taxi.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//startT = std::chrono::high_resolution_clock::now();
return 0;
}*/
Compilation message
cave.cpp: In function 'bool help(int)':
cave.cpp:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
cave.cpp: At global scope:
cave.cpp:66:5: error: ambiguating new declaration of 'int exploreCave(int)'
66 | int exploreCave(int N)
| ^~~~~~~~~~~
In file included from cave.cpp:9:
cave.h:10:6: note: old declaration 'void exploreCave(int)'
10 | void exploreCave(int N);
| ^~~~~~~~~~~
cave.cpp: In function 'int exploreCave(int)':
cave.cpp:68:24: error: 'n' was not declared in this scope
68 | for(int i = 0; i < n; i++)
| ^
cave.cpp:77:24: error: 'n' was not declared in this scope
77 | for(int i = 0; i < n; i++)
| ^
cave.cpp:79:27: error: cannot convert 'bool*' to 'int*'
79 | if(tryCombination(up) == i)
| ^~
| |
| bool*
In file included from cave.cpp:9:
cave.h:8:24: note: initializing argument 1 of 'int tryCombination(int*)'
8 | int tryCombination(int S[]);
| ~~~~^~~
cave.cpp:86:19: error: expected primary-expression before '=' token
86 | while(l < = r)
| ^
cave.cpp:90:39: error: cannot convert 'bool*' to 'int*'
90 | int save = tryCombination(up);
| ^~
| |
| bool*
In file included from cave.cpp:9:
cave.h:8:24: note: initializing argument 1 of 'int tryCombination(int*)'
8 | int tryCombination(int S[]);
| ~~~~^~~
cave.cpp:104:12: error: cannot convert 'bool*' to 'int*'
104 | answer(up , used);
| ^~
| |
| bool*
In file included from cave.cpp:9:
cave.h:9:17: note: initializing argument 1 of 'void answer(int*, int*)'
9 | void answer(int S[], int D[]);
| ~~~~^~~
cave.cpp:105:1: warning: no return statement in function returning non-void [-Wreturn-type]
105 | }
| ^