QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#766976#9621. 连方xiaoyilangCompile Error//C++231.4kb2024-11-20 19:29:482024-11-20 19:29:48

Judging History

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

  • [2024-11-20 19:29:48]
  • 评测
  • [2024-11-20 19:29:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
char a[N],b[N],c[N];
int n;
bool judge(){
	int cnt=0;
	for(int i=1;i<=n;i++)	if(c[i]=='#')	cnt++;
	if(cnt==0)	return false;
	for(int i=2;i<=n;i++){
		if(a[i-1]=='#'&&a[i]=='#'&&c[i-1]=='#'&&c[i]=='.')	return false;
		if(b[i-1]=='#'&&b[i]=='#'&&c[i-1]=='#'&&c[i]=='.')	return false;
	}
	return true;
}
void solve(){
	int cnt=0;
	cin>>n;
	cin>>a+1>>b+1;
	for(int i=1;i<=n;i++)
		if(a[i]==b[i])	cnt++;
	if(cnt==0||cnt==n){
		cout<<"Yes\n";
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
		return ;
	}
	if(a[1]=='.'&&b[1]=='.')	c[1]='#';
	else c[1]='.';
	for(int i=2;i<=n;i++){
		if(a[i]=='.'&&b[i]=='.')	c[i]='#';
		else if(a[i]=='#'&&b[i]=='#')	c[i]='.';
		else{
			if(a[i-1]==b[i-1])	c[i]='.';
			else{
				if(a[i-1]==c[i-1])	c[i]=a[i];
				else c[i]=b[i];
			}
		}
	}
	if(judge()){
		cout<<"Yes\n";
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<c+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
	}
	else cout<<"No\n";
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int T;
	cin>>T;
	while(T--)	solve();
	return 0;
} 
/*
4
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####

1
10
.##.###.##
##.#####.#
 */

Details

answer.code: In function ‘void solve()’:
answer.code:19:12: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   19 |         cin>>a+1>>b+1;
      |         ~~~^~~~~
      |         |     |
      |         |     char*
      |         std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
                 from answer.code:1:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:19:15: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’
   19 |         cin>>a+1>>b+1;
      |              ~^~
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:19:15: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive]
   19 |         cin>>a+1>>b+1;
      |              ~^~
      |               |
      |               char*
answer.code:19:15: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& a)) + 1)’ to ‘long long unsigned int&’
/usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:19:15: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive]
   19 |         cin>>a+1>>b+1;
      |              ~^~
      |               |
      |               char*
answer.code:19:15: error: cannot bind rvalue ‘(long long int)(((char*)(& a)) + 1)’ to ‘long long int&’
/usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:19:15: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive]
   19 |         cin>>a+1>>b+1;
      |              ~^~
      |               |
      |               char*
answer.code:19:15: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& a)) + 1)’ to ‘long unsigned int&’
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:188:7: note:   conversion of argument 1 would be ill-formed:
answer.code:19:15: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive]
   19 |         cin>>a+1>>b+1;
      |              ~^~
      |               |
      |               char*
answer.code:19:15: error: cannot bind rvalue ‘(long int)(((char*)(& a)) + 1)’ to ‘long int&’
/usr/include/c++/13/istream:184:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:184:7: note:   conversion of argument 1 would be ill-formed:
answer.code:19:15: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive]
   19 |         cin>>a+1>>b+1;
      |              ~^~
      |               |
      |               char*
answer.code:19:15: error: cannot bind rvalue ‘(unsigned int)(((char*)(& a)) + 1)’ to ‘unsigned int&’
/usr/include/c++/13/istream:181:7: note: candidate: ‘std::basi...