QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#535768 | #8904. Рекорды и антирекорды | Dimash# | 21 | 1876ms | 3868kb | C++23 | 1.0kb | 2024-08-28 14:30:24 | 2024-08-28 14:30:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 12, MOD = 998244353;
int calc(vector<int> &x,vector<int> &y) {
int mx = 0,res = 0;
for(int i:x) {
if(i > mx) {
mx = i;
res++;
}
}
int mn = (int)1e9;
for(int i:y) {
if(i < mn) {
mn = i;
res++;
}
}
return res;
}
void test() {
int n;
cin >> n;
vector<int> a(n);
for(int &i:a) {
cin >> i;
}
int res = 0;
for(int i = 0;i < (1 << n);i++) {
vector<int> x,y;
for(int j = 0;j < n;j++) {
if((i >> j) & 1) {
x.push_back(a[j]);
} else {
y.push_back(a[j]);
}
}
res = max(res,calc(x,y));
}
cout << res << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
while(t--) {
test();
}
}
详细
Subtask #1:
score: 21
Accepted
Test #1:
score: 21
Accepted
time: 1ms
memory: 3552kb
input:
120 5 3 1 4 2 5 5 3 4 2 5 1 5 5 4 2 1 3 5 1 2 5 4 3 5 2 4 3 1 5 5 3 1 5 2 4 5 1 4 2 3 5 5 5 1 4 3 2 5 1 5 3 2 4 5 3 1 2 5 4 5 3 1 5 4 2 5 1 2 3 4 5 5 1 5 2 4 3 5 3 5 2 1 4 5 2 1 5 4 3 5 1 5 3 4 2 5 3 1 4 5 2 5 2 1 4 5 3 5 1 3 5 4 2 5 5 3 4 2 1 5 2 1 3 5 4 5 2 3 1 5 4 5 2 4 3 5 1 5 4 3 2 5 1 5 4 5 2 ...
output:
5 5 5 5 5 4 5 5 5 4 4 5 5 5 4 5 5 4 5 5 4 4 5 5 4 5 4 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 4 5 5 5 4 5 5 5 5 4 5 5 5 5 5 5 4 5 5 5 5 5 5 4 5 4 5 5 5 5 4 5 5 4 5 4 5 4 5 5 4 4 4 4 5 5 4 4 5 5 5 4 5 4 5 5 5 4 5 4 5 5 4 4 5 5 5 4 5 5 5 5
result:
ok 120 numbers
Test #2:
score: 21
Accepted
time: 1876ms
memory: 3636kb
input:
120 16 11 8 4 12 3 6 10 9 7 15 14 2 16 5 1 13 16 9 1 13 14 3 7 5 15 4 11 2 12 8 6 16 10 16 3 12 11 10 5 13 4 8 9 2 7 16 6 14 15 1 16 9 4 7 2 3 8 1 13 5 12 16 14 11 10 6 15 16 14 5 11 10 6 12 7 9 1 16 15 3 4 8 13 2 16 3 13 16 10 5 11 8 4 15 2 9 7 14 1 6 12 16 4 16 7 11 15 5 9 14 8 13 6 3 1 2 12 10 16...
output:
10 10 12 9 11 10 11 12 10 11 9 10 10 9 12 11 12 10 9 10 10 8 11 10 10 11 11 11 9 11 9 10 11 11 11 12 11 10 13 11 11 11 11 10 10 12 10 10 11 9 10 11 10 11 11 12 12 10 11 11 11 10 9 10 12 10 12 11 11 10 11 11 9 11 11 9 11 11 11 11 10 10 11 11 10 10 12 10 8 12 13 10 9 12 11 10 11 11 11 13 11 10 9 10 11...
result:
ok 120 numbers
Test #3:
score: 21
Accepted
time: 298ms
memory: 3560kb
input:
120 16 10 7 5 9 12 6 3 1 13 15 2 8 11 16 14 4 13 11 1 10 8 7 9 5 4 6 2 13 3 12 14 2 5 10 12 13 14 6 7 1 3 9 4 8 11 9 7 9 8 6 2 5 4 3 1 11 9 8 1 6 7 4 3 2 11 5 10 12 12 1 3 7 11 5 9 8 6 2 4 10 12 10 8 2 6 4 1 3 5 12 11 7 9 14 9 3 12 10 13 4 5 14 11 7 6 8 1 2 16 1 15 10 3 6 5 4 14 2 9 8 7 11 13 16 12 ...
output:
11 10 9 8 9 10 10 9 12 7 11 10 9 9 8 8 6 7 5 7 7 6 5 8 5 9 9 6 8 9 7 9 11 7 8 9 7 10 6 8 7 8 9 8 9 10 7 6 7 8 7 7 7 9 9 12 7 8 8 10 9 9 6 12 7 8 6 12 8 8 6 6 6 8 8 6 6 7 6 11 11 10 7 9 12 10 8 7 5 7 8 10 11 5 10 8 8 7 8 7 5 5 11 6 12 5 6 10 5 7 10 6 10 7 9 9 8 10 8 9
result:
ok 120 numbers
Test #4:
score: 21
Accepted
time: 500ms
memory: 3564kb
input:
120 14 4 12 10 13 8 1 6 14 11 9 7 5 2 3 11 9 11 5 4 3 1 2 8 7 10 6 12 10 6 4 2 12 11 9 3 7 8 1 5 13 10 2 6 12 11 5 9 7 13 3 8 1 4 12 6 2 8 11 1 7 4 3 9 5 12 10 11 6 10 2 11 4 9 1 8 3 5 7 15 11 5 6 1 2 13 12 4 15 7 10 8 9 3 14 12 3 9 1 5 10 2 4 12 8 6 11 7 11 10 2 8 7 9 4 3 11 6 1 5 13 4 2 9 12 7 3 1...
output:
10 8 8 9 8 7 10 7 9 9 8 9 9 8 9 11 7 8 11 8 9 10 11 10 9 9 10 6 13 10 10 6 6 8 10 8 9 8 7 8 7 11 8 9 8 9 12 10 9 7 12 8 10 7 11 10 7 10 9 12 8 10 8 10 8 7 10 8 10 9 9 9 8 10 7 9 10 8 12 7 8 8 7 8 11 9 9 8 10 10 11 9 9 8 10 9 7 9 9 11 12 8 9 11 10 11 8 9 9 8 11 9 8 12 9 10 8 10 8 8
result:
ok 120 numbers
Test #5:
score: 21
Accepted
time: 0ms
memory: 3596kb
input:
32 4 1 4 3 2 4 4 1 3 2 4 4 3 2 1 4 1 3 2 4 4 1 2 3 4 4 3 4 2 1 3 1 2 3 4 1 3 4 2 4 3 1 4 2 2 2 1 4 2 4 1 3 4 2 1 4 3 3 2 3 1 4 3 2 4 1 4 2 3 1 4 4 4 1 2 3 4 1 4 2 3 4 4 2 1 3 4 2 1 3 4 4 3 1 2 4 4 2 4 3 1 2 1 2 4 3 2 1 4 4 4 2 3 1 3 3 1 2 3 3 2 1 4 4 3 1 2 4 2 3 4 1 4 3 4 1 2 4 1 2 4 3 3 1 3 2 3 2 1 3
output:
4 4 4 4 4 4 3 4 4 2 4 3 3 4 4 4 4 4 4 4 4 2 4 4 3 3 4 4 3 4 3 3
result:
ok 32 numbers
Test #6:
score: 21
Accepted
time: 561ms
memory: 3560kb
input:
120 16 16 1 14 12 7 2 6 8 9 10 11 13 15 5 4 3 16 3 5 16 7 12 15 9 4 6 8 10 2 11 13 14 1 15 1 15 2 5 14 3 13 12 11 10 9 8 7 6 4 11 11 9 3 6 2 4 8 7 10 5 1 15 15 2 3 11 12 10 7 5 6 4 8 13 1 9 14 14 3 4 13 6 14 5 10 12 9 11 8 7 2 1 13 1 3 10 13 9 12 11 8 7 6 4 5 2 13 3 13 12 10 8 4 9 7 5 6 11 2 1 13 2 ...
output:
16 14 14 9 13 12 11 12 11 10 15 11 11 16 15 11 10 12 14 13 10 12 11 8 10 14 10 13 14 13 12 10 9 11 12 10 10 11 15 14 13 13 9 10 10 16 15 10 12 11 12 15 8 13 13 11 12 13 9 16 11 11 15 11 12 9 15 16 14 10 14 10 16 15 15 13 12 11 15 10 16 11 10 11 14 9 13 13 16 14 12 11 11 16 11 15 14 14 14 12 16 14 15...
result:
ok 120 numbers
Test #7:
score: 21
Accepted
time: 484ms
memory: 3868kb
input:
120 10 9 5 8 10 7 6 4 3 2 1 15 2 14 11 3 7 8 6 9 10 12 5 13 15 4 1 12 4 5 12 11 8 7 6 9 3 2 1 10 10 10 5 8 9 7 6 4 3 2 1 12 10 2 9 6 4 3 5 7 8 12 11 1 15 2 15 12 13 3 11 7 14 10 9 8 6 5 4 1 14 13 12 11 10 8 7 6 5 4 14 9 3 1 2 10 4 6 1 5 7 8 3 9 10 2 16 15 13 1 8 2 5 3 4 6 7 9 10 11 12 14 16 14 14 1 ...
output:
10 15 12 10 11 14 12 9 16 13 12 15 9 12 11 12 16 13 10 16 15 10 12 13 11 11 16 10 16 10 13 13 12 12 14 13 12 12 13 14 15 10 10 9 11 12 12 12 10 15 8 16 12 10 16 12 10 12 15 11 14 12 13 15 15 16 13 16 14 11 11 14 12 12 10 11 11 13 9 11 12 10 16 14 9 14 12 11 11 16 14 10 11 11 16 11 10 15 10 11 10 15 ...
result:
ok 120 numbers
Test #8:
score: 21
Accepted
time: 1772ms
memory: 3856kb
input:
120 16 4 8 13 14 16 15 12 11 10 9 7 5 6 3 2 1 16 1 3 5 15 10 14 12 6 9 8 7 11 4 13 2 16 16 4 15 10 8 14 11 12 16 9 13 7 6 5 3 2 1 16 15 12 1 10 8 2 9 3 7 6 13 11 14 16 5 4 16 4 16 1 5 11 12 10 13 9 8 14 15 7 6 3 2 16 5 6 7 15 14 12 11 13 10 16 9 8 4 3 2 1 16 2 5 7 8 12 10 13 11 14 15 16 9 6 4 1 3 16...
output:
15 15 14 14 15 16 15 15 16 16 16 16 16 16 16 15 15 16 14 16 16 15 16 15 14 15 16 16 15 15 15 15 15 16 16 16 15 15 15 16 16 16 15 16 16 14 15 15 16 14 16 14 12 14 16 15 16 15 16 14 16 16 16 16 16 14 15 16 14 16 16 15 15 16 14 14 14 15 15 14 15 16 16 16 15 16 15 16 16 16 15 14 16 15 16 16 15 16 15 14 ...
result:
ok 120 numbers
Test #9:
score: 21
Accepted
time: 217ms
memory: 3784kb
input:
120 6 6 5 4 3 2 1 4 4 3 2 1 14 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 8 1 2 3 4 5 6 7 8 8 1 2 3 4 5 6 7 8 7 1 2 3 4 5 6 7 5 1 2 3 4 5 12 12 11 10 9 8 7 6 5 4 3 2 1 10 10 9 8 7 6 5 4 3 2 1 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 13 1 2 3 4 5 6 7 8 9 10 11 12 13 8 8 ...
output:
6 4 14 15 8 8 7 5 12 10 16 13 8 7 8 13 15 4 10 8 11 7 12 14 16 8 8 8 5 15 7 15 9 5 2 16 3 6 9 2 6 12 4 4 9 13 3 10 10 4 14 9 4 7 14 4 7 10 15 7 8 12 9 4 7 7 16 12 10 6 7 15 2 5 12 13 6 14 5 10 16 8 3 16 8 3 11 5 12 16 6 3 2 4 16 6 7 4 13 15 8 10 2 7 12 4 14 11 11 12 11 5 16 12 8 9 9 4 9 11
result:
ok 120 numbers
Test #10:
score: 21
Accepted
time: 1818ms
memory: 3856kb
input:
120 16 2 14 8 7 16 11 9 15 1 5 10 4 6 12 13 3 16 14 16 5 13 9 10 15 7 4 8 1 12 2 6 11 3 16 15 14 11 12 13 9 10 7 8 3 4 16 5 6 2 1 16 3 16 14 5 15 12 10 2 4 11 6 7 9 1 8 13 16 1 13 2 14 6 15 3 7 16 11 9 5 8 12 10 4 16 16 2 12 14 11 13 9 10 5 6 8 7 1 3 15 4 16 8 2 6 16 15 5 1 13 10 7 12 4 14 3 11 9 16...
output:
11 9 11 12 11 11 10 14 11 10 13 10 11 11 10 11 10 11 11 11 11 9 13 11 11 10 11 10 12 10 11 10 10 11 11 11 10 10 12 10 11 11 11 12 9 12 12 11 12 12 12 12 11 10 10 12 12 10 10 11 12 14 10 12 13 11 12 11 12 10 11 11 11 12 10 11 12 12 12 9 9 12 11 12 11 13 12 11 12 12 11 11 12 10 14 10 11 13 10 12 12 12...
result:
ok 120 numbers
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3792kb
input:
10 200 143 118 102 41 39 3 167 56 189 32 139 175 16 135 145 160 147 68 14 33 161 96 9 11 137 158 25 19 120 184 34 128 28 187 164 75 106 47 151 194 49 141 59 179 72 20 36 154 134 123 73 193 80 17 133 186 53 2 185 196 107 48 74 63 55 79 61 168 104 31 183 42 117 87 144 171 172 76 77 30 112 180 84 8 119...
output:
16 19 14 12 12 19 13 14 11 16
result:
wrong answer 1st numbers differ - expected: '42', found: '16'
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #5:
score: 0
Time Limit Exceeded
Test #49:
score: 0
Time Limit Exceeded
input:
9000 8 4 1 2 3 5 6 7 8 12 1 2 12 3 4 5 6 7 8 9 10 11 15 4 1 13 2 15 3 5 6 7 8 9 10 11 12 14 15 4 5 10 14 1 2 3 6 7 8 9 11 12 13 15 9 4 1 2 3 5 6 7 8 9 13 1 4 9 12 2 3 5 6 7 8 10 11 13 14 1 10 2 3 4 5 6 7 8 9 11 12 13 14 15 1 6 7 2 3 4 5 8 9 10 11 12 13 14 15 12 1 4 6 10 12 2 3 5 7 8 9 11 8 7 8 1 2 3...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%