Submission #559249

#TimeUsernameProblemLanguageResultExecution timeMemory
559249Koosha_mvScales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define dbgv(v) cout<<#v<<" = "; f(i,0,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 #define int ll //#include "scales.h" const int N=6; int n,t,A[N],ans[N]; bool cmp(int i,int j){ return A[i]<A[j]; } /* int getLightest(int a,int b,int c){ vector<int> vec; vec.pb(a); vec.pb(b); vec.pb(c); sort(all(vec),cmp); return vec[0]; } int getMedian(int a,int b,int c){ vector<int> vec; vec.pb(a); vec.pb(b); vec.pb(c); sort(all(vec),cmp); return vec[1]; } int getHeaviest(int a,int b,int c){ vector<int> vec; vec.pb(a); vec.pb(b); vec.pb(c); sort(all(vec),cmp); return vec[2]; }*/ void inst(vector<int> &vec,int id,int x){ vector<int> ans; f(i,0,vec.size()){ if(i==id) ans.pb(x); ans.pb(vec[i]); } if(ans.size()==vec.size()) ans.pb(x); vec=ans; } void init(int T) { } void orderCoins(){ vector<int> vec; vec.pb(getLightest(1,2,3)); vec.pb(getMedian(1,2,3)); vec.pb(vec[0]^vec[1]); f(i,4,N+1){ int l=0,r=i-1; while(l!=r){ int mid=(l+r-1)>>1,x=getMedian(vec[mid-1],vec[mid],i); //cout<<l<<" "<<r<<" "<<mid<<" -> "<<x<<endl; if(x==i){ inst(vec,x,i); break; } if(x==vec[mid-1]){ r=mid-1; } else{ l=mid+1; } dbgv(vec); } if(l==r) inst(vec,l,i); } f(i,0,N) ans[i]=i; //dbgv(vec); answer(ans); } /* int32_t main(){ ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0); f(i,1,N+1) cin>>A[i]; orderCoins(); }*/

Compilation message (stderr)

scales.cpp: In function 'void inst(std::vector<long long int>&, long long int, long long int)':
scales.cpp:58:14: warning: declaration of 'ans' shadows a global declaration [-Wshadow]
   58 |  vector<int> ans;
      |              ^~~
scales.cpp:27:14: note: shadowed declaration is here
   27 | int n,t,A[N],ans[N];
      |              ^~~
scales.cpp:8:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define f(i,a,b) for(int i=a;i<b;i++)
......
   59 |  f(i,0,vec.size()){
      |    ~~~~~~~~~~~~~~              
scales.cpp:59:2: note: in expansion of macro 'f'
   59 |  f(i,0,vec.size()){
      |  ^
scales.cpp: In function 'void init(long long int)':
scales.cpp:66:15: warning: unused parameter 'T' [-Wunused-parameter]
   66 | void init(int T) {
      |               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:71:10: error: 'getLightest' was not declared in this scope
   71 |   vec.pb(getLightest(1,2,3));
      |          ^~~~~~~~~~~
scales.cpp:72:10: error: 'getMedian' was not declared in this scope
   72 |   vec.pb(getMedian(1,2,3));
      |          ^~~~~~~~~
scales.cpp:3:36: warning: declaration of 'i' shadows a previous local [-Wshadow]
    3 | #define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
      |                                    ^
scales.cpp:8:26: note: in definition of macro 'f'
    8 | #define f(i,a,b) for(int i=a;i<b;i++)
      |                          ^
scales.cpp:89:4: note: in expansion of macro 'dbgv'
   89 |    dbgv(vec);
      |    ^~~~
scales.cpp:74:5: note: shadowed declaration is here
   74 |   f(i,4,N+1){
      |     ^
scales.cpp:8:26: note: in definition of macro 'f'
    8 | #define f(i,a,b) for(int i=a;i<b;i++)
      |                          ^
scales.cpp:8:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define f(i,a,b) for(int i=a;i<b;i++)
      |                               ^
scales.cpp:3:34: note: in expansion of macro 'f'
    3 | #define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
      |                                  ^
scales.cpp:89:4: note: in expansion of macro 'dbgv'
   89 |    dbgv(vec);
      |    ^~~~
scales.cpp:95:3: error: 'answer' was not declared in this scope
   95 |   answer(ans);
      |   ^~~~~~