QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73992 | #3170. Lunchtime Name Recall | UCSC_Ravioli# | TL | 6125ms | 3476kb | C++20 | 1.2kb | 2023-01-30 07:16:36 | 2023-01-30 07:16:40 |
Judging History
answer
// qdd on Jan 29, 2023
#ifdef qdd
#include <ringo>
#else
#include <bits/stdc++.h>
#define dbg(...)
#define dbgr(x, y)
#endif
using namespace std;
using ll = long long;
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
for (T& x : v) is >> x;
return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
bool f = 0;
for (const T& x : v) (f ? os << ' ' : os) << x, f = 1;
return os;
}
mt19937_64 rng(2023);
int a[10][30];
void sol() {
int n, m, x;
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> x;
for (int j = 0; j < x; j++) a[i][j] = (1 << i);
}
int ans = 0, t = 3333333;
while (t--) {
for (int i = 0; i < m; i++) {
shuffle(a[i], a[i] + n, rng);
}
map<int, int> mp;
for (int j = 0; j < n; j++) {
int sum = 0;
for (int i = 0; i < m; i++) {
sum += a[i][j];
}
mp[sum]++;
}
int now = 0;
for (auto& [x, y] : mp) {
if (y == 1) now++;
}
ans = max(ans, now);
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
sol();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 548ms
memory: 3456kb
input:
4 2 2 2
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 3024ms
memory: 3364kb
input:
16 3 6 8 8
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 670ms
memory: 3340kb
input:
5 2 2 2
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 3080ms
memory: 3352kb
input:
16 3 8 8 8
output:
6
result:
ok single line: '6'
Test #5:
score: 0
Accepted
time: 6125ms
memory: 3476kb
input:
20 7 1 1 1 1 6 8 8
output:
11
result:
ok single line: '11'
Test #6:
score: 0
Accepted
time: 1156ms
memory: 3308kb
input:
7 3 3 2 1
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 1791ms
memory: 3344kb
input:
9 4 1 1 3 3
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 1840ms
memory: 3404kb
input:
10 3 4 4 3
output:
6
result:
ok single line: '6'
Test #9:
score: 0
Accepted
time: 1940ms
memory: 3320kb
input:
10 3 4 4 5
output:
6
result:
ok single line: '6'
Test #10:
score: 0
Accepted
time: 2136ms
memory: 3348kb
input:
10 3 4 4 4
output:
7
result:
ok single line: '7'
Test #11:
score: 0
Accepted
time: 2370ms
memory: 3416kb
input:
12 3 6 6 6
output:
6
result:
ok single line: '6'
Test #12:
score: 0
Accepted
time: 2318ms
memory: 3416kb
input:
10 5 2 2 2 2 2
output:
7
result:
ok single line: '7'
Test #13:
score: 0
Accepted
time: 2778ms
memory: 3392kb
input:
10 6 2 2 2 2 2 2
output:
10
result:
ok single line: '10'
Test #14:
score: 0
Accepted
time: 1089ms
memory: 3452kb
input:
10 2 3 3
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 2759ms
memory: 3472kb
input:
10 6 8 5 2 8 8 1
output:
10
result:
ok single line: '10'
Test #16:
score: 0
Accepted
time: 1417ms
memory: 3352kb
input:
7 4 5 5 1 2
output:
5
result:
ok single line: '5'
Test #17:
score: 0
Accepted
time: 259ms
memory: 3304kb
input:
2 1 1
output:
2
result:
ok single line: '2'
Test #18:
score: 0
Accepted
time: 300ms
memory: 3388kb
input:
3 1 1
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 1662ms
memory: 3344kb
input:
30 1 15
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 616ms
memory: 3344kb
input:
3 5 1 1 1 1 1
output:
3
result:
ok single line: '3'
Test #21:
score: 0
Accepted
time: 1169ms
memory: 3384kb
input:
5 6 2 2 2 2 2 2
output:
5
result:
ok single line: '5'
Test #22:
score: -100
Time Limit Exceeded
input:
30 5 15 15 15 15 13