QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21653#2841. 赛艇gogo#Compile Error//C++204.3kb2022-03-07 18:31:122022-05-18 04:11:53

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:53]
  • 评测
  • [2022-03-07 18:31:12]
  • 提交

answer


		int pl = j + mny, pr = j + mxy;
		rep(i, 1, n) {
			del[i] = mp[i].getrange(pl, pr) >> pl;
		}#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;
}

Details

answer.code:5:18: error: stray ‘#’ in program
    5 |                 }#include<bits/stdc++.h>
      |                  ^
answer.code:2:26: error: ‘j’ was not declared in this scope
    2 |                 int pl = j + mny, pr = j + mxy;
      |                          ^
answer.code:2:30: error: ‘mny’ was not declared in this scope
    2 |                 int pl = j + mny, pr = j + mxy;
      |                              ^~~
answer.code:3:20: error: expected constructor, destructor, or type conversion before ‘(’ token
    3 |                 rep(i, 1, n) {
      |                    ^
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:27: error: ‘bits’ was not declared in this scope
    5 |                 }#include<bits/stdc++.h>
      |                           ^~~~
answer.code:5:32: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    5 |                 }#include<bits/stdc++.h>
      |                                ^~~~
      |                                std
answer.code:5:19: error: ‘include’ does not name a type
    5 |                 }#include<bits/stdc++.h>
      |                   ^~~~~~~
answer.code:19:9: error: ‘pair’ does not name a type
   19 | typedef pair<int, int> P;
      |         ^~~~
answer.code:20:1: error: ‘mt19937_64’ does not name a type
   20 | mt19937_64 hua(time(0));
      | ^~~~~~~~~~
answer.code:23:27: error: ‘array’ does not name a type
   23 | template<int T> using A = array<int, T>;
      |                           ^~~~~
answer.code: In function ‘int read()’:
answer.code:26:36: error: ‘getchar’ was not declared in this scope
   26 |         int x = 0, f = 1; char c = getchar();
      |                                    ^~~~~~~
answer.code:1:1: note: ‘getchar’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | 
answer.code:27:16: error: ‘isdigit’ was not declared in this scope
   27 |         for(; !isdigit(c); c = getchar()) if(c == '-')  f = 0;
      |                ^~~~~~~
answer.code:28:15: error: ‘isdigit’ was not ...