QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#262802 | #5750. Siteswap | GenshinImpactsFault | WA | 1ms | 3428kb | C++20 | 1.5kb | 2023-11-24 03:46:30 | 2023-11-24 03:46:30 |
Judging History
answer
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define db double
#define ve vector<int>
#define pa pair<int,int>
#define fr first
#define sd second
#define pb push_back
#define mp make_pair
#define MEM(a) memset(a,0,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
inline ll read()
{
char ch = getchar();
ll s = 0, w = 1;
while (ch < '0' || ch > '9') {if (ch == '-')w = -1; ch = getchar();}
while (ch >= '0' && ch <= '9') {s = s * 10 + ch - '0'; ch = getchar();}
return s * w;
}
#define N 1000010
int fa[N];
int find(int x) {return (x == fa[x] ? x : fa[x] = find(fa[x]));}
void sol()
{
int n;
cin >> n;
vector<int>a(n), g(n, 0);
vector<ll>s(n, 0);
for (int i = 0; i < n; i ++)cin >> a[i];
for (int i = 0; i < n; i ++)fa[i] = i;
for (int i = 0; i < n; i ++)
{
fa[find(i)] = find((i + a[i]) % n);
}
for (int i = 0; i < n; i ++)if (a[i] & 1)g[find(i)] = 1;
for (int i = 0; i < n; i ++)s[find(i)] += a[i];
ll A = 0, b = 0, c = 0;
for (int i = 0; i < n; i ++)if (find(i) == i)
{
assert(s[i] % n == 0);
ll w = s[i] / n;
if (g[i])c += w;
else
{
if (i & 1)b += w;
else A += w;
}
}
cout << A << ' ' << b << ' ' << c << '\n';
}
signed main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T; cin >> T;
while (T --)sol();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3364kb
input:
3 3 1 5 0 6 4 6 4 0 4 0 2 6 4
output:
0 0 2 2 1 0 3 2 0
result:
ok 9 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3344kb
input:
100 10 94 8 4 52 7 53 16 96 29 1 10 23 35 96 34 86 39 16 72 63 96 10 51 2 46 21 15 31 41 28 42 83 10 75 67 64 88 46 98 3 17 14 98 10 24 77 54 48 16 37 23 88 99 84 10 52 93 44 87 84 80 37 22 73 28 10 35 80 96 60 75 19 100 63 54 88 10 38 49 63 68 29 67 3 57 68 48 10 89 57 51 21 61 16 100 73 99 83 10 6...
output:
2 0 34 0 0 56 0 0 36 0 0 57 4 0 51 0 13 47 25 14 28 0 0 49 10 0 55 0 0 30 9 0 48 0 0 48 15 11 22 0 7 34 9 0 39 4 7 26 9 0 56 6 10 49 6 5 32 0 0 45 7 4 44 8 0 46 7 4 60 24 19 0 0 0 57 0 13 28 9 1 37 0 0 58 7 0 38 0 0 40 6 6 21 3 9 31 3 10 51 7 9 28 19 10 39 0 3 51 22 8 29 0 8 40 7 0 51 0 0 40 0 16 45...
result:
ok 300 numbers
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3428kb
input:
100 54 386 856 526 874 268 682 718 686 344 116 412 25 82 99 203 496 2 949 757 584 713 137 518 782 485 769 852 483 906 918 152 211 561 355 527 591 585 506 57 49 929 767 317 287 475 186 267 199 227 390 124 373 309 444 85 491 676 471 547 85 660 974 510 349 341 89 557 936 180 632 919 810 887 498 426 644...
output:
0 17 437 26 6 485 0 0 559 4 2 413 0 7 490 2 0 510 0 0 424 0 0 514 0 38 386 1 0 473 0 0 667 4 10 507 22 0 490 0 41 472 0 0 580 0 0 526 0 0 441 0 55 423 0 0 467 36 0 523 0 0 517 0 0 565 0 0 486 0 0 492 0 0 495 0 42 519 2 6 437 47 54 302 0 16 510 21 0 482 46 118 358 3 31 334 30 0 355 54 81 367 40 0 559...
result:
wrong answer 4th numbers differ - expected: '16', found: '26'