QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#73993#3170. Lunchtime Name RecallUCSC_Ravioli#WA 5397ms3472kbC++201.2kb2023-01-30 07:18:132023-01-30 07:18:14

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:18:14]
  • 评测
  • 测评结果:WA
  • 用时:5397ms
  • 内存:3472kb
  • [2023-01-30 07:18:13]
  • 提交

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 = 1333333;
  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: 234ms
memory: 3356kb

input:

4 2
2
2

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 1225ms
memory: 3324kb

input:

16 3
6
8
8

output:

5

result:

ok single line: '5'

Test #3:

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

input:

5 2
2
2

output:

3

result:

ok single line: '3'

Test #4:

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

input:

16 3
8
8
8

output:

6

result:

ok single line: '6'

Test #5:

score: 0
Accepted
time: 2562ms
memory: 3396kb

input:

20 7
1
1
1
1
6
8
8

output:

11

result:

ok single line: '11'

Test #6:

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

input:

7 3
3
2
1

output:

4

result:

ok single line: '4'

Test #7:

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

input:

9 4
1
1
3
3

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 764ms
memory: 3472kb

input:

10 3
4
4
3

output:

6

result:

ok single line: '6'

Test #9:

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

input:

10 3
4
4
5

output:

6

result:

ok single line: '6'

Test #10:

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

input:

10 3
4
4
4

output:

7

result:

ok single line: '7'

Test #11:

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

input:

12 3
6
6
6

output:

6

result:

ok single line: '6'

Test #12:

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

input:

10 5
2
2
2
2
2

output:

7

result:

ok single line: '7'

Test #13:

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

input:

10 6
2
2
2
2
2
2

output:

10

result:

ok single line: '10'

Test #14:

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

input:

10 2
3
3

output:

2

result:

ok single line: '2'

Test #15:

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

input:

10 6
8
5
2
8
8
1

output:

10

result:

ok single line: '10'

Test #16:

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

input:

7 4
5
5
1
2

output:

5

result:

ok single line: '5'

Test #17:

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

input:

2 1
1

output:

2

result:

ok single line: '2'

Test #18:

score: 0
Accepted
time: 116ms
memory: 3292kb

input:

3 1
1

output:

1

result:

ok single line: '1'

Test #19:

score: 0
Accepted
time: 604ms
memory: 3360kb

input:

30 1
15

output:

0

result:

ok single line: '0'

Test #20:

score: 0
Accepted
time: 251ms
memory: 3356kb

input:

3 5
1
1
1
1
1

output:

3

result:

ok single line: '3'

Test #21:

score: 0
Accepted
time: 474ms
memory: 3336kb

input:

5 6
2
2
2
2
2
2

output:

5

result:

ok single line: '5'

Test #22:

score: 0
Accepted
time: 4002ms
memory: 3452kb

input:

30 5
15
15
15
15
13

output:

28

result:

ok single line: '28'

Test #23:

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

input:

30 10
15
15
15
15
15
1
1
1
1
1

output:

30

result:

ok single line: '30'

Test #24:

score: -100
Wrong Answer
time: 5202ms
memory: 3344kb

input:

30 10
15
10
10
10
10
1
1
1
1
1

output:

26

result:

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