제출 #1071309

#제출 시각아이디문제언어결과실행 시간메모리
1071309vjudge1Addk (eJOI21_addk)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int; typedef long double ld; #define pb push_back #define sz size #define mp make_pair #define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define fre(s) freopen(s".in", "r", stdin);freopen(s".out", "w", stdout); #define s second #define f first #define ii pair<ll,ll> const ll mod=1e9+7; const int N=4e5+6; const ll inf=1e12+5; int n,k,d[N],g[N]; int main() { ios cin>>n>>k; for(int i=1;i<=n;++i) { cin>>d[i]; } int q; cin>>q; while(q--) { int x; cin>>x; if(x==1) { for(int i=0;i<k;++i) { cin>>g[i]; } if(k>1) { int h=d[g[0]]; for(int i=0;i<k-1;i++) { d[g[i]]=d[g[i+1]]; } d[g[k-1]]=h; } } else { int l,r,m; cin>>l>>r>>m; int ans=0; if(r-l+1<m) { cout<<0<<"\n"; continue; } for(int i=l;i<=r;++i) { int cur=m; cur-=max(0ll,m-(i-l+1)); cur-=max(0ll,m-(r-i+1)); ans+=d[i]*cur; } cout<<ans<<endl; } } }

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

Main.cpp:3:19: error: declaration does not declare anything [-fpermissive]
    3 | typedef long long int;
      |                   ^~~
Main.cpp:15:7: error: 'll' does not name a type; did you mean 'ld'?
   15 | const ll mod=1e9+7;
      |       ^~
      |       ld
Main.cpp:17:7: error: 'll' does not name a type; did you mean 'ld'?
   17 | const ll inf=1e12+5;
      |       ^~
      |       ld
Main.cpp: In function 'int main()':
Main.cpp:64:39: error: no matching function for call to 'max(long long int, int)'
   64 |                 cur-=max(0ll,m-(i-l+1));
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
Main.cpp:64:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   64 |                 cur-=max(0ll,m-(i-l+1));
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
Main.cpp:64:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   64 |                 cur-=max(0ll,m-(i-l+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 Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
Main.cpp:64:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   64 |                 cur-=max(0ll,m-(i-l+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 Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
Main.cpp:64:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   64 |                 cur-=max(0ll,m-(i-l+1));
      |                                       ^
Main.cpp:65:39: error: no matching function for call to 'max(long long int, int)'
   65 |                 cur-=max(0ll,m-(r-i+1));
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
Main.cpp:65:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   65 |                 cur-=max(0ll,m-(r-i+1));
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
Main.cpp:65:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   65 |                 cur-=max(0ll,m-(r-i+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 Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
Main.cpp:65:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   65 |                 cur-=max(0ll,m-(r-i+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 Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
Main.cpp:65:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   65 |                 cur-=max(0ll,m-(r-i+1));
      |                                       ^