QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21651#2841. 赛艇gogo#Compile Error//C++203.9kb2022-03-07 18:20:432022-05-18 04:11:47

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:47]
  • 评测
  • [2022-03-07 18:20:43]
  • 提交

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 = 1500;
const int V = 64;
const int maxl = 1500 / V; 
const int maxk = 5e6;
int n, m, k;
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, maxl) {
    		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;
	rep(j, l2, r2) {
		rep(i, l1, r1) {
			int p = 0, flg = 1;
			rep(k, i + mnx, i + mxx) {
				int pl = j + mny, pr = j + mxy;
//				cout << k << "----\n";
//				rep(x, 1, m) {
//					cout << mp[k].get(x);
//				}
//				cout << '\n';
				if((mp[k].getrange(pl, pr) >> pl).chk(use[p])) {
					flg = 0;
					break;
				}
				p ++;
			}
//			if(flg) {
//				cout << i << ' ' << j << '\n';
//			}
			ans += flg;
		}
	}
	cout << ans << '\n';
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:96:21: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   96 |                 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:96:26: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’
   96 |                 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:96:26: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive]
   96 |                 cin >> s + 1;
      |                        ~~^~~
      |                          |
      |                          char*
answer.code:96: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:96:26: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive]
   96 |                 cin >> s + 1;
      |                        ~~^~~
      |                          |
      |                          char*
answer.code:96: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:96:26: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
   96 |                 cin >> s + 1;
      |                        ~~^~~
      |                          |
      |                          char*
answer.code:96: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)
      |...