QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#780183 | #2432. Go with the Flow | LJY_ljy | Compile Error | / | / | C++20 | 1.2kb | 2024-11-25 07:11:56 | 2024-11-25 07:11:57 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
const int MAXN = 100;
const int MAXM = 3000;
char str[MAXN];
int n, len[MAXM], minn, sum, eid, maxx, cnt[MAXN * MAXM], ans, ansx;
set<int> G[MAXM];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> str + 1;
len[i] = strlen(str + 1);
minn = max(minn, len[i]);
sum += len[i];
}
for (int gap = minn; gap <= sum + MAXM; gap++) {
int maxx = 0;
int j = 1, Len = 0, eid1 = 0;
while (j <= n) {
++eid1;
while (Len + len[j] <= gap && j <= n) {
Len = Len + len[j] + 1;
if (Len + len[j + 1] <= gap && j < n) {
G[eid1].insert(Len);
int A = 0;
if (G[eid1 - 1].count(Len - 1)) A = max(A, cnt[Len - 1]);
if (G[eid1 - 1].count(Len)) A = max(A, cnt[Len]);
if (G[eid1 - 1].count(Len + 1)) A = max(A, cnt[Len + 1]);
cnt[Len] = A + 1;
maxx = max(maxx, cnt[Len]);
}
j++;
}
Len = 0;
}
for (int i = 1; i <= eid1; i++) {
for (auto x:G[i]) {
cnt[x] = 0;
}
G[i].clear();
}
if (maxx > ans) {
ans = maxx;
ansx = gap;
}
}
cout << ansx << " " << ans << endl;
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:17:21: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 17 | cin >> str + 1; | ~~~ ^~ ~~~~~~~ | | | | | char* | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/13/iostream:42, 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:17:28: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’ 17 | cin >> str + 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:17:28: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive] 17 | cin >> str + 1; | ~~~~^~~ | | | char* answer.code:17:28: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& str)) + 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:17:28: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive] 17 | cin >> str + 1; | ~~~~^~~ | | | char* answer.code:17:28: error: cannot bind rvalue ‘(long long int)(((char*)(& str)) + 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:17:28: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive] 17 | cin >> str + 1; | ~~~~^~~ | | | char* answer.code:17:28: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& str)) + 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:17:28: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive] 17 | cin >> str + 1; | ~~~~^~~ | | | char* answer.code:17:28: error: cannot bind rvalue ‘(long int)(((char*)(& str)) + 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:17:28: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive] 17 | cin >> str + 1; | ~~~~^~~ | | | char* answer.code:17:28:...