QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#597706 | #4276. Balls and Holes | cyx | TL | 4ms | 3812kb | C++14 | 2.9kb | 2024-09-28 18:30:18 | 2024-09-28 18:30:23 |
Judging History
answer
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
int n;
int ans;
vector<int> v[5020];
int main()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
int k;
cin >> k;
while (k--)
{
int x;
cin >> x;
v[i].push_back(x);
}
sort(v[i].begin(), v[i].end());
}
for (int i = 1; i <= n; i++)
{
for (int j = i + 1; j <= n; j++)
{
int x = 0, y = 0;
bool cnt[v[j].size()] = {};
int t = 0;
bool ok = 0;
while (x < v[i].size() && y < v[j].size())
{
if (v[i][x] <= v[j][y])
{
if (!cnt[y])
t++;
cnt[y] = 1;
x++;
}
else
{
y++;
}
}
ans += t & 1;
}
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3680kb
input:
2 1 1 2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 2 1 2 2 2 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 1 1 1 2
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
3 2 3 1 3 3 1 2 3 1 2 3
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
3 2 1 2 2 2 1 2 1 3
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
4 3 2 1 3 1 1 3 3 2 1 3 3 2 1
output:
6
result:
ok 1 number(s): "6"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
4 1 3 3 3 1 2 3 2 1 3 1 2
output:
5
result:
ok 1 number(s): "5"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
5 1 2 1 2 2 3 4 4 4 1 2 3 1 3
output:
9
result:
ok 1 number(s): "9"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
10 3 3 4 1 3 3 2 4 5 5 4 2 3 1 4 2 1 3 4 2 5 2 3 5 3 1 3 5 3 4 5 4 3 2 5 1 5 3 2 4 5 1 5 5 1 3 4 2
output:
27
result:
ok 1 number(s): "27"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
50 5 3 5 1 4 2 5 5 3 4 2 1 4 3 1 4 5 1 1 5 1 2 3 4 5 3 2 4 1 5 4 5 3 2 1 3 2 5 3 3 1 5 4 5 5 2 3 4 1 5 1 5 4 3 2 4 5 2 1 4 4 5 2 4 1 4 4 1 2 5 3 2 3 1 4 5 2 1 3 3 5 1 4 5 4 3 5 2 1 1 2 4 5 2 1 3 2 2 4 2 4 2 1 1 1 2 1 4 2 4 2 4 1 4 3 2 4 1 4 3 5 2 3 1 3 4 1 3 2 1 2 3 5 2 4 2 2 1 4 1 4 3 2 4 1 2 4 5 1...
output:
721
result:
ok 1 number(s): "721"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
50 7 2 10 9 5 6 3 1 10 1 6 4 7 9 2 10 3 8 5 10 2 1 10 7 8 4 6 3 9 5 4 3 8 9 5 3 4 5 2 10 3 7 1 4 10 2 9 5 6 8 5 1 9 3 4 7 8 2 5 3 8 6 4 7 1 1 10 10 3 8 6 2 9 10 4 5 1 7 7 4 10 9 8 6 3 2 8 4 9 6 3 1 7 10 5 7 10 5 6 3 4 1 7 9 3 1 10 8 7 6 4 2 5 2 1 2 7 3 5 8 4 1 2 10 5 8 2 3 10 5 10 10 2 8 1 5 3 4 7 9...
output:
596
result:
ok 1 number(s): "596"
Test #12:
score: 0
Accepted
time: 4ms
memory: 3772kb
input:
300 11 14 7 1 15 13 19 6 20 11 3 17 19 4 8 2 15 6 11 12 9 16 13 17 7 14 20 3 10 19 18 1 3 7 5 6 2 19 5 5 18 20 16 7 2 11 1 8 2 6 16 19 15 20 11 12 14 8 17 6 19 9 7 1 12 10 20 20 15 4 18 12 6 2 19 14 10 17 9 13 11 5 8 16 7 1 3 8 5 20 16 18 11 8 2 14 9 14 2 17 4 12 19 20 18 7 10 9 20 10 16 2 18 11 5 4...
output:
23348
result:
ok 1 number(s): "23348"
Test #13:
score: -100
Time Limit Exceeded
input:
5000 10 28 4 20 14 40 26 3 18 50 23 22 19 18 7 15 4 28 39 22 17 37 42 41 10 27 9 50 47 14 49 35 34 44 25 46 28 16 12 6 33 18 13 27 4 35 38 31 14 25 3 19 30 7 49 11 1 2 42 29 30 15 45 20 1 22 28 8 47 16 36 13 17 6 48 46 12 7 43 19 42 11 30 27 31 3 2 44 49 23 32 47 11 10 35 32 21 46 50 9 3 24 20 12 13...