답안 #535611

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
535611 2022-03-10T16:37:53 Z michao 송금 (JOI19_remittance) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int inf=(int)1e18+9;
const int MAX=1e6+5;
int a[MAX];
int b[MAX];
int32_t main(){
  BOOST;
  int n;
  cin>>n;
  for (int i=0;i<n;i++)cin>>a[i]>>b[i];
  
  for (int ile=1;ile<=40;ile++){
		for (int i=0;i<n;i++){
			int x=max(0LL,a[i]-b[i])/2;
			a[i]-=x*2;
			a[(i+1)%n]+=x;
		}
  }
  bool f1=true,f2=true,maxi=-inf;
  for (int i=0;i<n;i++){
		if (a[i]!=b[i])f1=false;
		if (a[i]-b[i]!=1)f2=false;
		maxi=max(maxi,a[i]);
  }
  if ((maxi-2>=0 && f2) || f1)cout<<"Yes";
  else cout<<"No";
  return 0; 
}

Compilation message

remittance.cpp: In function 'int32_t main()':
remittance.cpp:37:21: error: no matching function for call to 'max(bool&, long long int&)'
   37 |   maxi=max(maxi,a[i]);
      |                     ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from remittance.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:
remittance.cpp:37:21: note:   deduced conflicting types for parameter 'const _Tp' ('bool' and 'long long int')
   37 |   maxi=max(maxi,a[i]);
      |                     ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from remittance.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:
remittance.cpp:37:21: note:   deduced conflicting types for parameter 'const _Tp' ('bool' and 'long long int')
   37 |   maxi=max(maxi,a[i]);
      |                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from remittance.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:
remittance.cpp:37:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'bool'
   37 |   maxi=max(maxi,a[i]);
      |                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from remittance.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:
remittance.cpp:37:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'bool'
   37 |   maxi=max(maxi,a[i]);
      |                     ^