QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73997 | #3170. Lunchtime Name Recall | UCSC_Ravioli# | WA | 2754ms | 3472kb | C++20 | 1.3kb | 2023-01-30 07:46:30 | 2023-01-30 07:46:32 |
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 rng(chrono::steady_clock::now().time_since_epoch().count());
int a[10][30];
void sol() {
int n, m, x;
cin >> n >> m;
int extra = 0;
for (int i = 0; i < m; i++) {
cin >> x;
if (x == 1 || x == n - 1) {
i--;
m--;
extra++;
} else {
for (int j = 0; j < x; j++) a[i][j] = (1 << i);
}
}
int ans = 0, t = 2500000;
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 << min(n, ans + extra) << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
sol();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 475ms
memory: 3372kb
input:
4 2 2 2
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 2393ms
memory: 3472kb
input:
16 3 6 8 8
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 570ms
memory: 3392kb
input:
5 2 2 2
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 2422ms
memory: 3416kb
input:
16 3 8 8 8
output:
6
result:
ok single line: '6'
Test #5:
score: -100
Wrong Answer
time: 2754ms
memory: 3300kb
input:
20 7 1 1 1 1 6 8 8
output:
9
result:
wrong answer 1st lines differ - expected: '11', found: '9'