QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21628 | #2840. 绿绿与串串 | gogo# | Compile Error | / | / | C++20 | 2.5kb | 2022-03-07 17:07:58 | 2022-05-18 04:11:40 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-05-18 04:11:40]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-03-07 17:07:58]
- 提交
answer
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i ++)
#define per(i, r, l) for(int i = (r); i >= (l); i --)
#define trv(i, u, v) for(int i = head[u], v = e[i].to; i; v = e[i = e[i].nxt].to)
#define fi first
#define se second
#define all(s) s.begin(), s.end()
#define sz(s) (int)(s.size())
#define lb(s) ((s) & -(s))
#define pb push_back
using namespace std;
typedef unsigned long long u64;
typedef long long ll;
typedef pair<int, int> P;
mt19937_64 hua(time(0));
template<typename T> inline bool chkmx(T &x, T y) {return x < y ? x = y, 1 : 0;}
template<typename T> inline bool chkmn(T &x, T y) {return y < x ? x = y, 1 : 0;}
template<int T> using A = array<int, T>;
inline int read() {
int x = 0, f = 1; char c = getchar();
for(; !isdigit(c); c = getchar()) if(c == '-') f = 0;
for(; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return f ? x : -x;
}
const int maxn = 1e6;
const u64 bse = 131;
int n, nxt[maxn + 5];
char s[maxn + 5];
u64 f[maxn + 5], g[maxn + 5], pw[maxn + 5];
u64 getf(int l, int r) {
return f[r] - f[l - 1] * pw[r - l + 1];
}
u64 getg(int l, int r) {
return g[l] - g[r + 1] * pw[r - l + 1];
}
int main() {
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T;
pw[0] = 1;
rep(i, 1, maxn) pw[i] = pw[i - 1] * bse;
for(cin >> T; T; T --) {
cin >> s + 1;
n = strlen(s + 1);
rep(i, 1, n) f[i] = f[i - 1] * bse + s[i] - 'a';
per(i, n, 1) g[i] = g[i + 1] * bse + s[i] - 'a';
rep(i, 1, n - 1) {
char a = s[1], b = s[i + 1];
int p = min(n, 2 * i) - i - 1;
if(getf(i - p + 1, i) != getg(i + 2, i + 2 + p - 1)) {
continue;
}
if(2 * i > n) {
cout << i + 1 << ' ';
continue;
}
u64 s = getf(1, i), t = getf(i + 1, 2 * i);
int flg = 1;
for(int j = 2 * i + 1; j <= n; j += 2 * i) {
// if(i == 2) cout << j << '\n';
if(j + i - 1 > n) {
int p = n - j + 1;
if(getf(n - p + 1, n) != getf(1, p)) {
flg = 0; break;
}
}
else if(j + i + i - 1 > n) {
u64 x = getf(j, j + i - 1);
if(x != s) {
flg = 0; break;
}
int p = n - j - i + 1;
if(getf(n - p + 1, n) != getf(i + 1, i + p)) {
flg = 0; break;
}
}
else {
u64 x = getf(j, j + i - 1), y = getf(j + i, j + i + i - 1);
if(x != s || y != t) {
flg = 0;
break;
}
}
}
if(flg) cout << i + 1 << ' ';
}
cout << '\n';
}
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:46:21: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 46 | cin >> s + 1; | ~~~ ^~ ~~~~~ | | | | | char* | std::istream {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:46:26: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’ 46 | cin >> 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:46:26: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive] 46 | cin >> s + 1; | ~~^~~ | | | char* answer.code:46:26: 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:46:26: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive] 46 | cin >> s + 1; | ~~^~~ | | | char* answer.code:46:26: 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:46:26: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive] 46 | cin >> s + 1; | ~~^~~ | | | char* answer.code:46:26: 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>>(unsigned int& __n) |...