QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#556453#4666. Delete And WinWorld_CreaterCompile Error//C++20546b2024-09-10 18:30:252024-09-10 18:30:25

Judging History

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

  • [2024-09-10 18:30:25]
  • 评测
  • [2024-09-10 18:30:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int nxt[100005][27];
char s[100005],t[100005];
int n,m,ans;
int main()
{
	cin>>s+1>>t+1;
	n=strlen(s+1),m=strlen(t+1);
	fill(nxt[n+1],nxt[n+1]+26,n+1);
	ans=n;
	for(int i=n;i>=1;i--)
	{
		memcpy(nxt[i],nxt[i+1],sizeof(nxt[i]));
		nxt[i][s[i]-'a']=i;
	}
	for(int i=1,p=1,s=0;i<=m&&p<=n;i++)
	{
		int nw=n;
		int c=t[i]-'a';
		for(int j=0;j<c;j++)
		{
			if(nxt[p][j]!=n+1) nw=min(nw,s+nxt[p][j]-p);
		}
		ans=min(ans,nw);
		s+=nxt[p][c]-p;
		p=nxt[p][c]+1;
	}
	cout<<ans;
}

Details

answer.code: In function ‘int main()’:
answer.code:8:12: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
    8 |         cin>>s+1>>t+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:8:15: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’
    8 |         cin>>s+1>>t+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:8:15: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive]
    8 |         cin>>s+1>>t+1;
      |              ~^~
      |               |
      |               char*
answer.code:8:15: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& s)) + 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:8:15: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive]
    8 |         cin>>s+1>>t+1;
      |              ~^~
      |               |
      |               char*
answer.code:8:15: error: cannot bind rvalue ‘(long long int)(((char*)(& s)) + 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:8:15: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive]
    8 |         cin>>s+1>>t+1;
      |              ~^~
      |               |
      |               char*
answer.code:8:15: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& s)) + 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:8:15: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive]
    8 |         cin>>s+1>>t+1;
      |              ~^~
      |               |
      |               char*
answer.code:8:15: error: cannot bind rvalue ‘(long int)(((char*)(& s)) + 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:8:15: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive]
    8 |         cin>>s+1>>t+1;
      |              ~^~
      |               |
      |               char*
answer.code:8:15: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’
/usr/include/c++/13/istream:181:7: note: candidate: ‘std::basic_istream<_Cha...