QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#484195#8600. Футболgreen_gold_dog#0 114ms7776kbC++201.7kb2024-07-19 16:45:092024-07-19 16:45:09

Judging History

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

  • [2024-07-19 16:45:09]
  • 评测
  • 测评结果:0
  • 用时:114ms
  • 内存:7776kb
  • [2024-07-19 16:45:09]
  • 提交

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

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;
	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, x)]] << ' ';
	}
	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: 10
Accepted
time: 0ms
memory: 3588kb

input:

2 1
2 1
1

output:

1 

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

2 100
1 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok 100 numbers

Test #3:

score: -10
Wrong Answer
time: 0ms
memory: 3580kb

input:

90 100
61 83 44 52 58 27 36 57 2 68 74 47 38 13 76 28 48 78 75 67 89 80 1 6 72 3 29 54 88 87 73 81 71 51 59 25 37 46 33 9 11 70 45 49 69 17 53 32 42 18 64 24 22 23 31 90 5 55 79 41 12 8 82 63 20 26 85 21 66 60 10 7 77 4 34 62 14 16 35 39 86 30 65 43 56 19 50 40 84 15
28 88 7 31 86 8 16 72 81 32 89 8...

output:

1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

wrong answer 5th numbers differ - expected: '5', found: '1'

Subtask #2:

score: 0
Wrong Answer

Test #38:

score: 4
Accepted
time: 114ms
memory: 7776kb

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:

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

result:

ok 150000 numbers

Test #39:

score: -4
Wrong Answer
time: 95ms
memory: 7192kb

input:

143220 150000
24534 72329 33958 25432 9575 12565 16832 59291 103684 74775 68515 64244 95757 60764 49241 62774 4082 17225 50101 141175 117631 76280 90071 8204 51269 8021 62039 30369 96748 92627 61206 131171 121848 13125 41025 93021 125471 65341 22532 10412 71786 62668 19346 36892 132218 6846 132635 4...

output:

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

result:

wrong answer 37034th numbers differ - expected: '3', found: '1'

Subtask #3:

score: 0
Wrong Answer

Test #68:

score: 11
Accepted
time: 58ms
memory: 5712kb

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:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 300000 numbers

Test #69:

score: 0
Accepted
time: 57ms
memory: 5692kb

input:

228359 300000
141993 27122 18203 22377 123220 185891 150204 116468 190784 113243 23498 160111 78566 170803 90303 100694 158128 65848 108261 166202 72156 181776 166212 197059 192482 54518 218891 11099 98486 77262 221897 89233 168861 210125 39429 217689 195530 48351 131846 101445 119750 150702 33006 1...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 300000 numbers

Test #70:

score: -11
Wrong Answer
time: 58ms
memory: 5764kb

input:

229081 300000
104084 90225 159598 188001 125378 192428 96293 180608 55108 98436 94622 24083 195329 12583 76226 68193 217540 62469 4445 91770 111151 76309 103708 74077 201695 156254 48415 21771 163005 157423 226460 127623 5381 105167 90848 67893 22397 50436 166615 188171 4387 162326 167485 182817 227...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

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

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Wrong Answer

Test #133:

score: 0
Wrong Answer
time: 18ms
memory: 3632kb

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:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer 206th numbers differ - expected: '3', found: '1'

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%