QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#73994#3170. Lunchtime Name RecallUCSC_Ravioli#WA 5595ms3468kbC++201.2kb2023-01-30 07:33:232023-01-30 07:33:24

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-30 07:33:24]
  • 评测
  • 测评结果:WA
  • 用时:5595ms
  • 内存:3468kb
  • [2023-01-30 07:33:23]
  • 提交

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(20232023);

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 = 1900000;
  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: 324ms
memory: 3340kb

input:

4 2
2
2

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 1681ms
memory: 3468kb

input:

16 3
6
8
8

output:

5

result:

ok single line: '5'

Test #3:

score: 0
Accepted
time: 377ms
memory: 3404kb

input:

5 2
2
2

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 1691ms
memory: 3400kb

input:

16 3
8
8
8

output:

6

result:

ok single line: '6'

Test #5:

score: 0
Accepted
time: 3343ms
memory: 3344kb

input:

20 7
1
1
1
1
6
8
8

output:

11

result:

ok single line: '11'

Test #6:

score: 0
Accepted
time: 643ms
memory: 3412kb

input:

7 3
3
2
1

output:

4

result:

ok single line: '4'

Test #7:

score: 0
Accepted
time: 989ms
memory: 3344kb

input:

9 4
1
1
3
3

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 1079ms
memory: 3456kb

input:

10 3
4
4
3

output:

6

result:

ok single line: '6'

Test #9:

score: 0
Accepted
time: 1141ms
memory: 3392kb

input:

10 3
4
4
5

output:

6

result:

ok single line: '6'

Test #10:

score: 0
Accepted
time: 1099ms
memory: 3316kb

input:

10 3
4
4
4

output:

7

result:

ok single line: '7'

Test #11:

score: 0
Accepted
time: 1383ms
memory: 3296kb

input:

12 3
6
6
6

output:

6

result:

ok single line: '6'

Test #12:

score: 0
Accepted
time: 1321ms
memory: 3344kb

input:

10 5
2
2
2
2
2

output:

7

result:

ok single line: '7'

Test #13:

score: 0
Accepted
time: 1582ms
memory: 3416kb

input:

10 6
2
2
2
2
2
2

output:

10

result:

ok single line: '10'

Test #14:

score: 0
Accepted
time: 645ms
memory: 3340kb

input:

10 2
3
3

output:

2

result:

ok single line: '2'

Test #15:

score: 0
Accepted
time: 1587ms
memory: 3388kb

input:

10 6
8
5
2
8
8
1

output:

10

result:

ok single line: '10'

Test #16:

score: 0
Accepted
time: 842ms
memory: 3364kb

input:

7 4
5
5
1
2

output:

5

result:

ok single line: '5'

Test #17:

score: 0
Accepted
time: 147ms
memory: 3312kb

input:

2 1
1

output:

2

result:

ok single line: '2'

Test #18:

score: 0
Accepted
time: 166ms
memory: 3288kb

input:

3 1
1

output:

1

result:

ok single line: '1'

Test #19:

score: 0
Accepted
time: 871ms
memory: 3348kb

input:

30 1
15

output:

0

result:

ok single line: '0'

Test #20:

score: 0
Accepted
time: 348ms
memory: 3340kb

input:

3 5
1
1
1
1
1

output:

3

result:

ok single line: '3'

Test #21:

score: 0
Accepted
time: 670ms
memory: 3284kb

input:

5 6
2
2
2
2
2
2

output:

5

result:

ok single line: '5'

Test #22:

score: -100
Wrong Answer
time: 5595ms
memory: 3388kb

input:

30 5
15
15
15
15
13

output:

26

result:

wrong answer 1st lines differ - expected: '28', found: '26'