Submission #385807

#TimeUsernameProblemLanguageResultExecution timeMemory
385807Pichon5Cave (IOI13_cave)C++17
0 / 100
527 ms384 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]; int s[n]; vector<bool>vis(n,false); 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; int b=0,e=n; int pos; 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 or x==-1){ pos=b; e=mid-1; }else{ b=mid+1; } } //pos es el switch que abrio la puerta vis[pos]=true; d[pos]=i; s[pos]=!c; } answer(s,d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:49:15: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   49 |         s[pos]=!c;
      |         ~~~~~~^~~
#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...