QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#232540#7559. Bocchi the Rocksinsop90Compile Error//C++231.3kb2023-10-30 16:15:272023-10-30 16:15:27

Judging History

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

  • [2023-10-30 16:15:27]
  • 评测
  • [2023-10-30 16:15:27]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int maxn = 5e4 + 5, mod = 998244353;
int f[2][2][2][maxn], ans, n;
char s[maxn];
void add(int &x, int y) {
	x += y;
	if(x >= mod) x -= mod;
}
void solve(int x) {
	f[0][x][0][0] = 1;
	int op = 1;
	for(int i = 1;i <= n;i++) {
		memset(f[op], 0, sizeof(f[op]));
		for(int j = 0;j < 2;j++) {
			for(int k = 0;k < 2;k++) {
				for(int l = 0;l < i;l++) {
					if(!f[op ^ 1][j][k][l]) continue;
					for(int u = 0;u < 2;u++) {
						if(s[2 * i + 1] == 'Y' && u) continue;
						if(s[2 * i + 1] == 'P' && !u) continue;
						for(int v = 0;v < 2;v++) {
							if(s[2 * i] == 'R' && v) continue;
							if(s[2 * i] == 'B' && !v) continue;
							if(u == j) add(f[op][u][k][l], f[op ^ 1][j][k][l]);
							else if(!l) add(f[op][u][v][1], f[op ^ 1][j][k][l]);
							else if(v == k && l == 1) add(f[op][u][0][0], f[op ^ 1][j][k][l]);
							else add(f[op][u][v][l + (v == k ? -1 : 1)], f[op ^ 1][j][k][l]);
						}
					}
				}
			}
		}
		op ^= 1;
	}
	add(ans, f[op ^ 1][x][0][0]);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> (s + 1);
	s[2 * n + 1] = '?';
	if(s[1] != 'Y') solve(1);
	if(s[1] != 'P') solve(0);
	cout << ans << '\n';
}

Details

answer.code: In function ‘int main()’:
answer.code:42:18: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   42 |         cin >> n >> (s + 1);
      |         ~~~~~~~~ ^~ ~~~~~~~
      |             |          |
      |             |          char*
      |             std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included 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/istream:168:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  168 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:168:7: note:   conversion of argument 1 would be ill-formed:
answer.code:42:24: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’
   42 |         cin >> n >> (s + 1);
      |                     ~~~^~~~
In file included 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/istream:172:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  172 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/11/istream:172:7: note:   conversion of argument 1 would be ill-formed:
answer.code:42:24: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive]
   42 |         cin >> n >> (s + 1);
      |                     ~~~^~~~
      |                        |
      |                        char*
answer.code:42:24: error: cannot bind rvalue ‘(short int)(((char*)(& s)) + 1)’ to ‘short int&’
In file included 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/istream:175:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  175 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:175:7: note:   conversion of argument 1 would be ill-formed:
answer.code:42:24: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive]
   42 |         cin >> n >> (s + 1);
      |                     ~~~^~~~
      |                        |
      |                        char*
answer.code:42:24: error: cannot bind rvalue ‘(short unsigned int)(((char*)(& s)) + 1)’ to ‘short unsigned int&’
In file included 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/istream:179:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  179 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/11/istream:179:7: note:   conversion of argument 1 would be ill-formed:
answer.code:42:24: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
   42 |         cin >> n >> (s + 1);
      |                     ~~~^~~~
      |                        |
      |                        char*
answer.code:42:24: error: cannot bind rvalue ‘(int)(((char*)(& s)) + 1)’ to ‘int&’
In file included 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/istream:182: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>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  182 |       operator>>(...