QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#65111#5119. Perfect WordsunseaCompile Error//C++14853b2022-11-27 16:52:472022-11-27 16:52:49

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-27 16:52:49]
  • 评测
  • [2022-11-27 16:52:47]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+20;
map<string,int> mp;
map<string,int> mp1;
vector<string> s[N];
void solve(){
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		string x;
		cin>>x;
		mp[x]++;
		s[x.size()].push_back(x);
	}
	int i;
	for(i=1;i<=1e5+20;i++){
		if(i==1){
			for(int j=0;j<=s[i].size()-1;j++){
				mp1[s[i][j]]=1;
			}
			continue;
		}
		int flag=0;
		//cout<<s[i].size()<<endl;
		for(int j=0;j<=(int)s[i].size()-1;j++){
			//cout<<j<<endl;
			//cout<<s[i][j].substr(0,s[i][j].size()-1);
			if(mp1[s[i][j].substr(0,s[i][j].size()-1)]&&mp1[s[i][j].substr(1,s[i][j].size()-1)]){
				mp1[s[i][j]]=1;
				flag=1;
			}
		}
		if(!flag) break;
	}
	cout<<max(1,i-1)<<endl;
}
signed main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	solve();
	return 0;
}

详细

answer.code: In function ‘void solve()’:
answer.code:36:18: error: no matching function for call to ‘max(int, long long int)’
   36 |         cout<<max(1,i-1)<<endl;
      |               ~~~^~~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
answer.code:36:18: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
   36 |         cout<<max(1,i-1)<<endl;
      |               ~~~^~~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
answer.code:36:18: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
   36 |         cout<<max(1,i-1)<<endl;
      |               ~~~^~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)’
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
answer.code:36:18: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
   36 |         cout<<max(1,i-1)<<endl;
      |               ~~~^~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)’
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
answer.code:36:18: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
   36 |         cout<<max(1,i-1)<<endl;
      |               ~~~^~~~~~~