QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362855#8515. KMOPucup-team3113#Compile Error//C++201.2kb2024-03-23 17:23:082024-03-23 17:23:09

Judging History

你现在查看的是最新测评结果

  • [2024-03-23 17:23:09]
  • 评测
  • [2024-03-23 17:23:08]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
#define int int64_t
#define pii pair<int, int>
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound

using namespace std;

const int inf = 1e18;

void p(auto A){
	for(auto e : A)cout << e << ' ';
	cout << '\n';
}

void solve(){
	int n; cin >> n;
	vector<string>A(n);
	for(int i = 0; i< n; i++)cin >> A[i];
	vector<array<int, 3>>dp(n+1, {inf, inf, inf});
	auto xmin = [](int& a, int b){a = min(a, b);};
	
	dp[0][0] = 0;
	for(int i = 0; i< n; i++){
		dp[i+1][1] = dp[i][0] + 1;
		dp[i+1][2] = dp[i][1] + 1;
		int cons = 0;
		for(int j = 0; j< min((int)A[i].size(), 3ll); j++){
			if(A[i][j]=='A'||A[i][j]=='E'||A[i][j]=='O'||A[i][j]=='U'||A[i][j]=='Y'){
				for(int k = 0; k< 3; k++)if(cons+k<=2){
					xmin(dp[i+1][0], dp[i][k] + j + 1);
				}
			}
			else cons++;
		}
	}
	int ans = inf;
	xmin(ans, dp[n][0]);
	xmin(ans, dp[n][1]);
	xmin(ans, dp[n][2]);
	if(ans == inf)cout << '*';
	else cout << ans;
}

	
		

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int t = 1;
	//cin >> t;
	while(t--)solve();
}


//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);

Details

answer.code: In function ‘void solve()’:
answer.code:32:38: error: no matching function for call to ‘min(int64_t, long long int)’
   32 |                 for(int j = 0; j< min((int)A[i].size(), 3ll); j++){
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
answer.code:32:38: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long int’ and ‘long long int’)
   32 |                 for(int j = 0; j< min((int)A[i].size(), 3ll); j++){
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
answer.code:32:38: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long int’ and ‘long long int’)
   32 |                 for(int j = 0; j< min((int)A[i].size(), 3ll); j++){
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)’
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
answer.code:32:38: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long int’
   32 |                 for(int j = 0; j< min((int)A[i].size(), 3ll); j++){
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
answer.code:32:38: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long int’
   32 |                 for(int j = 0; j< min((int)A[i].size(), 3ll); j++){
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~