QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#663999 | #8790. First Billion | daoqi | WA | 4ms | 3640kb | C++20 | 959b | 2024-10-21 18:52:45 | 2024-10-21 18:52:46 |
Judging History
answer
#include<bits/stdc++.h>
using i64 = long long;
using l64 = long double;
std::mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());
void DAOQI() {
int n;
std::cin >> n;
std::vector<i64> a(n + 1), p(n + 1);
for (int i = 1; i <= n; i++) {
std::cin >> a[i];
p[i] = i;
}
for (int i = 1; i <= 10000000; i++) {
i64 sum = 0;
for (int l = 1, r = 1; r <= n; r++) {
sum += a[r];
while (sum > 1e9) sum -= a[p[l++]];
if (sum == 1e9) {
std::cout << r - l + 1 << " ";
for (int k = l; k <= r; k++) std::cout << p[k] << " ";
return;
}
}
shuffle(p.begin() + 1, p.end(), rng);
}
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T = 1;
//std::cin >> T;
while (T--) DAOQI();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
10 386413329 88494216 245947398 316438989 192751270 204627269 65749456 3938400 150458676 345180997
output:
5 4 3 10 8 2
result:
ok OK (n = 10)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
10 119486233 299942886 169540407 349937991 597883752 32230162 140514533 57341098 12602102 220520836
output:
5 7 1 4 3 10
result:
ok OK (n = 10)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
14 384615281 84612238 83310504 54746763 142296081 56775470 128760350 343006424 177232390 214368720 67220468 21895072 16352717 224807522
output:
7 10 6 1 12 7 9 13
result:
ok OK (n = 14)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
14 270208635 14270307 89661499 113578022 47687195 101043954 38775146 208193324 650676076 351701957 3427619 59535626 24230888 27009752
output:
7 12 4 3 1 2 10 6
result:
ok OK (n = 14)
Test #5:
score: -100
Wrong Answer
time: 4ms
memory: 3640kb
input:
20 61638928 106712373 5946815 178135484 4937573 111395400 15504655 67139983 101814514 312223647 130341028 43244171 37671364 54108486 337181317 37924824 153793862 70383750 102917244 66984582
output:
10 5 9 8 11 4 10 13 14 12 20
result:
wrong answer need sum 1000000000, got sum 996600832