제출 #623283

#제출 시각아이디문제언어결과실행 시간메모리
623283Koosha_mv던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.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=50500,lg=26; const ll inf=1e18+99; int n; int par[lg/2][N][lg]; ll Min[lg/2][N][lg]; ll prt[lg/2][N][lg]; vector<int> s,p,w,t; void init(int _n,vector<int> _s,vector<int> _p,vector<int> _w,vector<int> _t) { n=_n; s=_s,p=_p,w=_w,t=_t; s.pb((1<<(lg-1))); w.pb(-1); t.pb(-1); p.pb(-1); f(l,0,lg/2){ f(i,0,n+1){ if(s[i]<=(1<<(l<<1))){ par[l][i][0]=w[i]; prt[l][i][0]=s[i]; Min[l][i][0]=inf; } else{ par[l][i][0]=t[i]; prt[l][i][0]=p[i]; Min[l][i][0]=(i==n ? 0 : s[i]); } } f(j,1,lg){ f(i,0,n+1){ int nxt=par[l][i][j-1]; par[l][i][j]=par[l][nxt][j-1]; prt[l][i][j]=prt[l][i][j-1]+prt[l][nxt][j-1]; if(Min[l][nxt][j-1]<inf){ Min[l][i][j]=min(Min[l][i][j-1],int(max(0ll,Min[l][nxt][j-1]-prt[l][i][j-1]))); } else{ Min[l][i][j]=Min[l][i][j-1]; } } } } } ll simulate(int pos,int _val){ int l=0; ll val=_val; while(1){ while((1<<(2*(l+1)))<=val && l+1<lg/2) l++; if((1<<(2*l))>val) assert(0); //cout<<pos<<" "<<val<<" -> "<<l<<endl; f_(i,lg-1,0){ if(Min[l][pos][i]>val){ val+=prt[l][pos][i]; pos=par[l][pos][i]; } } if(pos==n) break ; //cout<<"posval "<<pos<<" "<<val<<endl; if(val<s[pos]) assert(0); val+=s[pos]; pos=w[pos]; } return val; } /* 3 1 2 6 9 3 1 2 2 2 3 1 0 1 0 1 */

컴파일 시 표준 에러 (stderr) 메시지

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:60:83: error: no matching function for call to 'min(long long int&, int)'
   60 |      Min[l][i][j]=min(Min[l][i][j-1],int(max(0ll,Min[l][nxt][j-1]-prt[l][i][j-1])));
      |                                                                                   ^
In file included from /usr/include/c++/10/vector:60,
                 from dungeons.h:1,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
dungeons.cpp:60:83: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |      Min[l][i][j]=min(Min[l][i][j-1],int(max(0ll,Min[l][nxt][j-1]-prt[l][i][j-1])));
      |                                                                                   ^
In file included from /usr/include/c++/10/vector:60,
                 from dungeons.h:1,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
dungeons.cpp:60:83: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |      Min[l][i][j]=min(Min[l][i][j-1],int(max(0ll,Min[l][nxt][j-1]-prt[l][i][j-1])));
      |                                                                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dungeons.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
dungeons.cpp:60:83: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |      Min[l][i][j]=min(Min[l][i][j-1],int(max(0ll,Min[l][nxt][j-1]-prt[l][i][j-1])));
      |                                                                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dungeons.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
dungeons.cpp:60:83: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |      Min[l][i][j]=min(Min[l][i][j-1],int(max(0ll,Min[l][nxt][j-1]-prt[l][i][j-1])));
      |                                                                                   ^