QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#536518 | #8236. Snake Move | ucup-team956 | Compile Error | / | / | C++20 | 1.0kb | 2024-08-29 14:13:06 | 2024-08-29 14:13:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};
const int N = 3005;
int n, m, k;
char a[3005][3005];
int X[N * N], Y[N * N];
int d[3005][3005], b[3005][3005];
vector<pair<int, int>> q[N * N];
int main(void) {
ios::sync_with_stdio(0);
cin >> n >> m >> k;
for (int i = 1; i <= k; ++i) cin >> X[i] >> Y[i], b[X[i]][Y[i]] = k - i;
for (int i = 1; i <= n; ++i) cin >> a[i] + 1;
memset(d, -1, sizeof d);
q[d[X[1]][Y[1]] = 0].emplace_back(X[1], Y[1]);
ull ans = 0;
for (int c = 0; c < N * N - 1; ++c) for (auto [x, y] : q[c]) {
ans += 1ll * c * c;
for (int i = 0; i < 4; ++i) {
int xx = x + DX[i], yy = y + DY[i];
if (xx < 1 || yy < 1 || xx > n || yy > m || a[xx][yy] == '#' || d[xx][yy] != -1) continue;
q[d[xx][yy] = max(c, b[xx][yy]) + 1].emplace_back(xx, yy);
}
}
cout << ans << '\n';
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:18:38: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 18 | for (int i = 1; i <= n; ++i) cin >> a[i] + 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:18:46: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’ 18 | for (int i = 1; i <= n; ++i) cin >> a[i] + 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:18:46: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive] 18 | for (int i = 1; i <= n; ++i) cin >> a[i] + 1; | ~~~~~^~~ | | | char* answer.code:18:46: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& a[i])) + 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:18:46: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive] 18 | for (int i = 1; i <= n; ++i) cin >> a[i] + 1; | ~~~~~^~~ | | | char* answer.code:18:46: error: cannot bind rvalue ‘(long long int)(((char*)(& a[i])) + 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:18:46: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive] 18 | for (int i = 1; i <= n; ++i) cin >> a[i] + 1; | ~~~~~^~~ | | | char* answer.code:18:46: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& a[i])) + 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:18:46: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive] 18 | for (int i = 1; i <= n; ++i) cin >> a[i] + 1; | ~~~~~^~~ | | | char* answer.code:18:46: error: cannot bind rvalue ‘(long int)(((char*)(& a[i])) + 1)’ to ‘long int&’ /usr/include/c++/13/istream:184:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_...