Submission #385748

#TimeUsernameProblemLanguageResultExecution timeMemory
385748Pichon5Cave (IOI13_cave)C++17
0 / 100
438 ms364 KiB
#include "cave.h" #include<bits/stdc++.h> #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 pos; 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){ //no se abrio b=mid+1; }else{ pos=b; //se abrio e=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:50:15: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   50 |         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...