QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#510164#8258. Gift Exchangegreen_gold_dogCompile Error//C++201.8kb2024-08-08 21:42:432024-08-08 21:42:44

Judging History

你现在查看的是最新测评结果

  • [2024-08-08 21:42:44]
  • 评测
  • [2024-08-08 21:42:43]
  • 提交

answer

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,abm,popcnt,mmx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef complex<double> cd;

constexpr ll INF64 = 9'000'000'000'000'000'000, INF32 = 2'000'000'000, MOD = 1'000'000'007;
constexpr db PI = acos(-1);
constexpr bool IS_FILE = false, IS_TEST_CASES = false;

random_device rd;
mt19937 rnd32(rd());
mt19937_64 rnd64(rd());

template<typename T>
bool assign_max(T& a, T b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
bool assign_min(T& a, T b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
T square(T a) {
	return a * a;
}

template<>
struct std::hash<pair<ll, ll>> {
	ll operator() (pair<ll, ll> p) const {
		return ((__int128)p.first * MOD + p.second) % INF64;
	}
};

void solve() {
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (ll i = 0; i < n; i++) {
		cin >> b[i];
	}
	set<ll> bad;
	for (ll i = 1; i + 1 < n; i++) {
		if (a[i - 1] < b[i] && a[i] < b[i + 1]) {
			bad.insert(i + 1);
		}
	}
	ll q;
	cin >> q;
	for (ll i = 0; i < q; i++) {
		ll l, r;
		cin >> l >> r;
		l--;
		vector<ll> na, nb;
		for (ll i = l; i < r; i++) {
			na.push_back(a[i]);
			nb.push_back(b[i]);
		}
		bool b = true;
		for (auto[_, x] : all) {
			ns += x;
			if (x > 0) {
				continue;
			}
			if (ns == 0) {
				if (!b2) {
					b = false;
					break;
				}
				b2 = false;
			} else {
				b2 = true;
			}
		}
		cout << (b ? "Yes" : "No") << '\n';
	}
}

int main() {
	if (IS_FILE) {
		freopen("", "r", stdin);
		freopen("", "w", stdout);
	}
    	ios_base::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
	ll t = 1;
	if (IS_TEST_CASES) {
		cin >> t;
	}
	for (ll i = 0; i < t; i++) {
		solve();
	}
}

Details

answer.code: In function ‘void solve()’:
answer.code:78:35: error: ‘all’ was not declared in this scope
   78 |                 for (auto[_, x] : all) {
      |                                   ^~~
answer.code:78:35: note: suggested alternatives:
In file included from /usr/include/c++/13/filesystem:48,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200,
                 from answer.code:3:
/usr/include/c++/13/bits/fs_fwd.h:154:7: note:   ‘std::filesystem::perms::all’
  154 |       all               =  0777,
      |       ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:89:
/usr/include/c++/13/ranges:1308:27: note:   ‘std::ranges::views::all’
 1308 |     inline constexpr _All all;
      |                           ^~~
answer.code:79:25: error: ‘ns’ was not declared in this scope; did you mean ‘nb’?
   79 |                         ns += x;
      |                         ^~
      |                         nb
answer.code:84:38: error: ‘b2’ was not declared in this scope; did you mean ‘b’?
   84 |                                 if (!b2) {
      |                                      ^~
      |                                      b
answer.code:88:33: error: ‘b2’ was not declared in this scope; did you mean ‘b’?
   88 |                                 b2 = false;
      |                                 ^~
      |                                 b
answer.code:90:33: error: ‘b2’ was not declared in this scope; did you mean ‘b’?
   90 |                                 b2 = true;
      |                                 ^~
      |                                 b
answer.code: In function ‘int main()’:
answer.code:99:24: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   99 |                 freopen("", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~
answer.code:100:24: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  100 |                 freopen("", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~