QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21654 | #2841. 赛艇 | gogo# | Compile Error | / | / | C++20 | 4.3kb | 2022-03-07 18:31:41 | 2022-05-18 04:11:54 |
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:54]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-03-07 18:31:41]
- 提交
answer
#pragma GCC optimze("Ofast")
#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 = 1500;
const int V = 64;
const int maxl = 1500 / V;
const int maxk = 5e6;
int n, m, k, ok[maxn + 5][maxn + 5];
int lim;
char s[maxk + 5];
struct Bitset {
u64 a[maxl + 5];
void flip(int p) {
int u = p / V, v = p % V;
a[u] ^= 1ull << v;
}
void set(int p, int x) {
int u = p / V, v = p % V;
if((a[u] >> v & 1) != x) a[u] ^= 1ull << v;
}
int get(int p) {
int u = p / V, v = p % V;
return (a[u] >> v & 1);
}
Bitset operator & (Bitset b) {
rep(i, 0, maxl) b.a[i] &= a[i];
return b;
}
Bitset operator >> (int k) {
Bitset b;
int s = k / V, r = k % V, v = V - r;
if(v == V) {
rep(i, 0, maxl - s) b.a[i] = a[i + s];
}
else {
int lim = maxl - s - 1;
rep(i, 0, lim) b.a[i] = a[i + s] >> r | a[i + s + 1] << v;
b.a[lim + 1] = a[lim + 1 + s] >> r;
}
rep(i, maxl - s + 1, maxl) b.a[i] = 0;
return b;
}
Bitset getrange(int l, int r) {
int u = l / V, v = r / V;
int ql = l % V, qr = r % V;
Bitset b;
memset(b.a, 0, sizeof b.a);
rep(i, u + 1, v - 1) b.a[i] = a[i];
if(u == v) {
b.a[u] = 0;
rep(i, ql, qr) b.a[u] |= a[u] & (1ull << i);
}
else {
b.a[u] = 0;
rep(i, ql, V - 1) b.a[u] |= a[u] & (1ull << i);
b.a[v] = 0;
rep(i, 0, qr) b.a[v] |= a[v] & (1ull << i);
}
return b;
}
bool chk(Bitset &x) {
rep(i, 0, lim) {
if(a[i] & x.a[i]) {
return 1;
}
}
return 0;
}
}mp[maxn + 5], memuse[maxn + 5 << 1], *use = memuse + maxn + 5, del[maxn + 5];
int main() {
// freopen("in.txt", "r", stdin);
n = read(), m = read(), k = read();
rep(i, 1, n) {
cin >> s + 1;
rep(j, 1, m) mp[i].set(j, s[j] - '0');
}
cin >> s + 1;
int curx = 0, cury = 0;
int mxx = 0, mnx = 0, mxy = 0, mny = 0;
rep(i, 1, k) {
if(s[i] == 'd') cury ++;
if(s[i] == 'a') cury --;
if(s[i] == 'w') curx --;
if(s[i] == 's') curx ++;
chkmx(mxx, curx);
chkmn(mnx, curx);
chkmx(mxy, cury);
chkmn(mny, cury);
}
curx = -mnx, cury = -mny;
use[curx].set(cury, 1);
rep(i, 1, k) {
if(s[i] == 'd') cury ++;
if(s[i] == 'a') cury --;
if(s[i] == 'w') curx --;
if(s[i] == 's') curx ++;
use[curx].set(cury, 1);
}
int l1 = 1 - mnx, r1 = n - mxx;
int l2 = 1 - mny, r2 = m - mxy;
int ans = 0;
lim = (mxy - mny) / V;
rep(j, l2, r2) {
int pl = j + mny, pr = j + mxy;
rep(i, 1, n) {
del[i] = mp[i].getrange(pl, pr) >> pl;
}
rep(i, l1, r1) if(i + j & 1) {
int p = 0, flg = 1;
rep(k, i + mnx, i + mxx) {
if(del[k].chk(use[p])) {
flg = 0;
break;
}
p ++;
}
ok[i][j] = flg;
ans += flg;
}
}
rep(j, l2, r2) {
int pl = j + mny, pr = j + mxy;
rep(i, 1, n) {
del[i] = mp[i].getrange(pl, pr) >> pl;
}
rep(i, l1, r1) if(1 + i + j & 1) {
if(ok[i - 1][j] && ok[i][j - 1] && ok[i][j + 1] && ok[i + 1][j]) {
ans ++;
continue;
}
int p = 0, flg = 1;
rep(k, i + mnx, i + mxx) {
if(del[k].chk(use[p])) {
flg = 0;
break;
}
p ++;
}
ans += flg;
}
}
cout << ans << '\n';
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:99:21: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’) 99 | 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:2: /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:99:26: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’ 99 | 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:2: /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:99:26: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive] 99 | cin >> s + 1; | ~~^~~ | | | char* answer.code:99: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:2: /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:99:26: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive] 99 | cin >> s + 1; | ~~^~~ | | | char* answer.code:99: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:2: /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:99:26: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive] 99 | cin >> s + 1; | ~~^~~ | | | char* answer.code:99: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:2: /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) |...