Submission #598417

#TimeUsernameProblemLanguageResultExecution timeMemory
598417Koosha_mvCave (IOI13_cave)C++14
0 / 100
500 ms552 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define dbgv(v) cout<<#v<<" = "; f(i,0,int(v.size())) cout<<v[i]<<" "; cout<<endl #define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl #define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl #define eror(x) cout<<#x<<'='<<(x)<<endl #define f_(i,a,b) for(int i=a;i>=b;i--) #define f(i,a,b) for(int i=a;i<b;i++) #define nb(x) __builtin_popcount(x) #define all(v) v.begin(),v.end() #define bit(n,k) (((n)>>(k))&1) #define Add(x,y) x=(x+y)%mod #define maxm(a,b) a=max(a,b) #define minm(a,b) a=min(a,b) #define lst(x) x[x.size()-1] #define sz(x) int(x.size()) #define mp make_pair #define ll long long #define pb push_back #define S second #define F first const int N=5050; int n,p[N],mark[N],state[N]; void exploreCave(int _n) { n=_n; vector<int> vec(n); iota(all(vec),0); while(vec.size()){ f(i,0,n) mark[i]=state[i]; int now=tryCombination(mark); int l=0,r=vec.size(); while(l+1<r){ int mid=(l+r)>>1; f(i,0,vec.size()) mark[vec[i]]=(i<mid); if(tryCombination(mark)==now){ l=mid; } else{ r=mid; } } f(i,0,vec.size()) mark[vec[i]]=(i<r); int prt=tryCombination(mark); int id=vec[l]; if(now!=-1 && (prt==-1 || prt>now)){ p[id]=now; state[id]=1; } else{ eror(prt); p[id]=prt; state[id]=0; } vec.erase(vec.begin()+l); } answer(state,p); } //tryCombination

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:9:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define f(i,a,b) for(int i=a;i<b;i++)
......
   38 |             f(i,0,vec.size()) mark[vec[i]]=(i<mid);
      |               ~~~~~~~~~~~~~~   
cave.cpp:38:13: note: in expansion of macro 'f'
   38 |             f(i,0,vec.size()) mark[vec[i]]=(i<mid);
      |             ^
cave.cpp:9:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define f(i,a,b) for(int i=a;i<b;i++)
......
   46 |         f(i,0,vec.size()) mark[vec[i]]=(i<r);
      |           ~~~~~~~~~~~~~~       
cave.cpp:46:9: note: in expansion of macro 'f'
   46 |         f(i,0,vec.size()) mark[vec[i]]=(i<r);
      |         ^
#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...