QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412922#8332. Two in OnechenjiaqiyWA 67ms3492kbC++171.4kb2024-05-16 21:40:532024-05-16 21:40:53

Judging History

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

  • [2024-05-16 21:40:53]
  • 评测
  • 测评结果:WA
  • 用时:67ms
  • 内存:3492kb
  • [2024-05-16 21:40:53]
  • 提交

answer

#include <bits/stdc++.h>  //�ص������㰮�ҵĶ���
using namespace std;
#define endl '\n'
#define ll long long
#define ld long double
#define umap unordered_map
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define rep_(i, l, r) for (int i = l; i >= r; i--)
#define debug(a) cout << #a << "=" << a << endl;
#define pb push_back
#define all(v) v.begin(), v.end()
#define alls(a) a + 1, a + 1 + n
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define c1 cout << -1 << endl
int _, n, k, m;
typedef pair<int, int> PII;
priority_queue<int> maxx;
priority_queue<int, vector<int>, greater<int> > minx;
const int N = 2e5 + 10, inf = 1e9;
const double eps = 1e-8;
const double pi = acos(-1);
const int mod = 1e9 + 7;

void solve() {
  cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  for (int i = 0; i < n; i++) cin >> a[i], mp[a[i]]++;

  int ma1 = -1, ma2 = -1;
  int t1, t2;
  for (auto &[x, y] : mp) {
    if (y > ma1) {
      ma1 = y;
      t1 = x;
    }
  }
  for (auto &[x, y] : mp) {
    if (y > ma2 && y < ma1) {
      ma2 = y;
      t2 = x;
    }
  }
  if(ma1 >= 3) ma2 = ma1 - 2;
  //cout << ma2 << endl;
  int t = ma1 | ma2;
  cout << t << endl;
}

int main() {
  /*ios::sync_with_stdio(false);
  cin.tie(nullptr);*/
  cin >> _;
  //_ = 1;
  while (_--) {
    solve();
  }
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3492kb

input:

1
7
1 2 3 4 3 2 1

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

1
9
1 1 1 1 1 2 2 2 2

output:

7

result:

ok 1 number(s): "7"

Test #3:

score: -100
Wrong Answer
time: 67ms
memory: 3484kb

input:

50
10000
72 65 90 94 67 93 41 43 54 83 31 34 38 37 44 42 92 63 66 79 90 45 41 40 19 54 34 90 13 74 40 77 41 57 74 86 91 79 34 39 21 88 90 57 23 31 8 15 80 27 45 38 53 96 51 82 70 71 19 75 62 95 31 67 99 97 94 29 90 7 95 82 61 98 62 77 43 65 66 30 41 69 38 79 51 9 63 77 13 30 72 70 67 93 92 45 74 50 ...

output:

215
207
214
222
210
214
207
223
206
206
218
230
254
214
210
207
218
211
206
207
230
223
231
199
255
218
215
222
214
203
198
226
255
222
226
223
230
223
206
222
222
223
223
255
222
230
223
211
211
214

result:

wrong answer 1st numbers differ - expected: '255', found: '215'