Submission #385810

#TimeUsernameProblemLanguageResultExecution timeMemory
385810Pichon5Cave (IOI13_cave)C++17
100 / 100
1035 ms876 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 s[n]; int d[n]; int res[n]; vector<bool>vis(n+1,false); for(int i=0;i<n;i++){ for(int l=0;l<n;l++){ if(vis[l])continue; s[l]=0; } int x=tryCombination(s); int c=1; if(x>i or x==-1){ c=0; } int b=0,e=n-1; int pos=0; while(b<=e){ int mid=(b+e)/2; for(int l=0;l<n;l++){ if(vis[l])continue; s[l]=c; if(l<b or l>mid)s[l]=!c; } x=tryCombination(s); if(x>i or x==-1){ pos=b; e=mid-1; }else{ pos=mid+1; b=mid+1; } } vis[pos]=1; s[pos]=c; res[pos]=c; d[pos]=i; } answer(res,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...