This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// build command - g++ grader.c 2013_Cave.cpp
#include<bits/stdc++.h>
#include "cave.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define INF INT_MAX
#define MOD 1000000007
#define all(x) x.begin(), x.end()
vi good, bad, switches;
/*
vi cfrs(int l, int r, int c1, int c2){
// color all values in bad from index l->r
// with color c1 and the rest with color c2.
vi tmp = good;
for(int x = 0; x < bad.size(); x++){
if(l <= x && x <= r) tmp[bad[x]] = c1;
else tmp[bad[x]] = c2;
}
return tmp;
}
int ask(vi &tmp){
return tryCombination(tmp.data());
}
void calc(int N, int x){
int l = 0, r = bad.size()-1;
vi tmp = cfrs(l, r, 0, 0);
int v1 = ask(tmp);
if(v1 == -1) v1 = N;
int col = 0;
if(v1 < x+1) col = 1;
while(l < r){
int mid = (l+r)/2;
tmp = cfrs(l, mid, col, col^1);
v1 = ask(tmp);
if(v1 == -1){
v1 = N;
}
if(v1 >= x+1) r = mid;
else l = mid+1;
}
switches[bad[l]] = x;
good[bad[l]] = col;
bad.erase(bad.begin()+l);
return;
}
*/
void exploreCave(int N){
std::ifstream fin("cave.in");
fin >> N;
good.resize(N); switches.resize(N);
for(int x = 0; x < N; x++) fin >> good[x];
for(int x = 0; x < N; x++) fin >> switches[x];
answer(good.data(), switches.data());
return;
/*
for(int x = 0; x < N; x++)
bad.push_back(x);
for(int x = 0; x < N; x++){
calc(N, x);
//for(int x = 0; x < N; x++)
//cout << good[x] << " ";
//cout << endl;
}
answer(good.data(), switches.data());
return;
*/
}
# | 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... |