QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#578673#9310. Permutation Counting 4QHhee004Compile Error//C++17493b2024-09-20 20:45:382024-09-20 20:45:38

Judging History

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

  • [2024-09-20 20:45:38]
  • 评测
  • [2024-09-20 20:45:38]
  • 提交

answer

#include<iostream>

using namespace std;
const int N=1e6+5;
int fa[N];
int getfa(int x) {
	if(fa[x]!=x)return fa[x]=getfa(fa[x]);
	return x;
} 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(false);
	cout.tie(false);
	int T;cin>>T;
	while(T--) {
		int n;cin>>n;
		for(int i=1; i<=n+1; i++)fa[i]=i;
		int ans=1;
		for(int i=1,l,r; i<=n; i++) {
			cin>>l>>r;
			l=getfa(l),r=getfa(r+1);
			if(l==r)ans=0;
			else fa[r]=l;
		}
		cout<<ans<<'\n';
	} 
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:12:16: error: no matching function for call to ‘std::basic_istream<char>::tie(bool)’
   12 |         cin.tie(false);
      |         ~~~~~~~^~~~~~~
In file included from /usr/include/c++/13/ios:46,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from answer.code:1:
/usr/include/c++/13/bits/basic_ios.h:295:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]’
  295 |       tie() const
      |       ^~~
/usr/include/c++/13/bits/basic_ios.h:295:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/13/bits/basic_ios.h:307:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]’
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/13/bits/basic_ios.h:307:43: note:   no known conversion for argument 1 from ‘bool’ to ‘std::basic_ostream<char>*’
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
answer.code:13:17: error: no matching function for call to ‘std::basic_ostream<char>::tie(bool)’
   13 |         cout.tie(false);
      |         ~~~~~~~~^~~~~~~
/usr/include/c++/13/bits/basic_ios.h:295:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]’
  295 |       tie() const
      |       ^~~
/usr/include/c++/13/bits/basic_ios.h:295:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/13/bits/basic_ios.h:307:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]’
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/13/bits/basic_ios.h:307:43: note:   no known conversion for argument 1 from ‘bool’ to ‘std::basic_ostream<char>*’
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~