Submission #385805

#TimeUsernameProblemLanguageResultExecution timeMemory
385805Pichon5Cave (IOI13_cave)C++17
0 / 100
409 ms632 KiB
#include "cave.h" #include<bits/stdc++.h> #include <fstream> #define lcm(a,b) (a/__gcd(a,b))*b #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long int #define vi vector<int> #define vll vector<ll> #define pb push_back #define F first #define S second //"\n" using namespace std; void exploreCave(int N){ int n=N; int d[n];//d[i] es la puerta conectada con i switch int s[n];//estos son los estados vector<bool>vis(n,false);//ya abri esta puerta for(int i=0;i<n;i++){ int c=0; for(int l=0;l<n;l++){ if(!vis[l])s[l]=0; } int x=tryCombination(s); if(x==i)c=1;//asi se abre esta puerta int b=0,e=n; while(b<e){ int mid=(b+e)/2; for(int l=0;l<n;l++){ if(vis[l])continue; if(l>=b && l<=mid){ s[l]=c; }else{ s[l]=!c; } } x=tryCombination(s); if(x==i){ b=mid+1; }else{ e=mid-1; } } //pos es el switch que abrio la puerta vis[b]=true; d[b]=i; s[b]=c; } answer(s,d); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...