QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#484235#8600. Футболgreen_gold_dog#0 75ms7700kbC++202.0kb2024-07-19 16:59:482024-07-19 16:59:49

Judging History

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

  • [2024-07-19 16:59:49]
  • 评测
  • 测评结果:0
  • 用时:75ms
  • 内存:7700kb
  • [2024-07-19 16:59:48]
  • 提交

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 int 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;
	}
};

ll gcd(ll a, ll b) {
	return (min(a, b) == 0 ? max(a, b) : gcd(max(a, b) % min(a, b), min(a, b)));
}

void solve() {
	ll n, q;
	cin >> n >> q;
	vector<ll> c(n);
	for (ll i = 0; i < n; i++) {
		cin >> c[i];
	}
	vector<vector<ll>> dn;
	map<ll, ll> to;
	for (ll i = 1; i <= n; i++) {
		if (n % i == 0) {
			vector<ll> now(i, INF32);
			for (ll j = 0; j < n; j++) {
				assign_min(now[j % i], c[j]);
			}
			to[i] = dn.size();
			dn.push_back(now);
		}
	}
	vector<ll> ans(dn.size(), INF32);
	ll nsum = 0;
	ll a = -1;
	for (ll i = 0; i < q; i++) {
		ll x;
		cin >> x;
		//nsum += x;
		for (ll j = 0; j < dn.size(); j++) {
			assign_min(ans[j], dn[j][nsum % dn[j].size()]);
		}
		cout << ans[to[gcd(n, nsum)]] << ' ';
		x = gcd(n, x);
		if (a == -1) {
			a = INF32;
			ll nn = 0;
			do {
				assign_min(a, c[nn]);
				nn += x;
				nn %= n;
			} while (nn != 0);
		}
		//cout << a << ' ';
	}
	cout << '\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

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3564kb

input:

2 1
2 1
1

output:

2 

result:

wrong answer 1st numbers differ - expected: '1', found: '2'

Subtask #2:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 75ms
memory: 7700kb

input:

147840 150000
51955 126047 19305 15169 98491 83561 117203 117454 128806 11992 121483 459 147794 90253 74660 36430 145671 95804 131911 2992 15875 98400 8460 42838 33469 140328 134827 18359 147461 133604 9654 131981 145644 85202 30317 25085 27990 11397 53520 142147 41480 126743 53905 49586 108298 6886...

output:

51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 51955 ...

result:

wrong answer 1st numbers differ - expected: '3', found: '51955'

Subtask #3:

score: 0
Wrong Answer

Test #68:

score: 0
Wrong Answer
time: 38ms
memory: 5728kb

input:

227561 300000
73189 67918 59157 26519 101740 188677 6268 205191 174583 176677 78190 126611 30812 65842 138072 18276 70837 103758 127302 2932 127000 49555 91327 7897 182706 108236 29655 56692 90510 215347 157427 104979 140920 184749 95668 45218 130382 120415 18647 165909 201803 36717 92674 209990 448...

output:

73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 73189 ...

result:

wrong answer 1st numbers differ - expected: '1', found: '73189'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Wrong Answer

Test #133:

score: 0
Wrong Answer
time: 14ms
memory: 3920kb

input:

2048 150000
1369 1292 383 872 441 332 63 1307 1335 1731 24 261 1699 1215 1818 1136 560 358 211 1165 723 1514 1670 241 598 474 317 1182 658 1596 1352 1663 406 1326 1461 678 366 768 581 216 50 822 1746 1860 1403 1052 370 1413 1440 1559 1029 1575 512 713 377 821 1425 1868 1944 338 459 322 1799 96 874 6...

output:

1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 1369 ...

result:

wrong answer 1st numbers differ - expected: '1', found: '1369'

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%