QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#454603#8813. Records in Chichén Itzáhos_lyricWA 13ms3816kbC++141.9kb2024-06-25 05:45:462024-06-25 05:45:46

Judging History

This is the latest submission verdict.

  • [2024-06-25 05:45:46]
  • Judged
  • Verdict: WA
  • Time: 13ms
  • Memory: 3816kb
  • [2024-06-25 05:45:46]
  • Submitted

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


int N;
vector<int> D;

bool solve() {
  int freq[4] = {};
  for (int u = 0; u < N; ++u) {
    ++freq[min(D[u], 3)];
  }
  if (freq[3] == 0) {
    return false;
  } else if (freq[3] == 1) {
    return (freq[2] >= 2);
  } else if (freq[3] == 2 || freq[3] == 3) {
    return (freq[2] >= 1);
  } else {
    return true;
  }
}

int main() {
  for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    scanf("%d", &N);
    D.resize(N);
    for (int u = 0; u < N; ++u) {
      scanf("%d", &D[u]);
    }
    sort(D.begin(), D.end());
    
    const bool ans = solve();
    puts(ans ? "Yes" : "No");
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3660kb

input:

3
6
1 1 1 1 3 3
5
1 1 2 2 2
10
1 1 1 1 2 2 2 2 3 3

output:

No
No
Yes

result:

ok 3 tokens

Test #2:

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

input:

1
2
1 1

output:

No

result:

ok "No"

Test #3:

score: 0
Accepted
time: 11ms
memory: 3816kb

input:

100000
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1
2
1 1...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #4:

score: -100
Wrong Answer
time: 13ms
memory: 3728kb

input:

50000
3
1 1 2
3
1 1 2
2
1 1
4
1 1 2 2
5
1 1 1 2 3
2
1 1
4
1 1 2 2
4
1 1 2 2
3
1 1 2
3
1 1 2
3
1 1 2
4
1 1 2 2
2
1 1
4
1 1 2 2
3
1 1 2
2
1 1
4
1 1 2 2
3
1 1 2
6
1 1 1 2 2 3
5
1 1 1 2 3
5
1 1 1 1 4
4
1 1 1 3
8
1 1 1 1 1 2 3 4
3
1 1 2
4
1 1 2 2
6
1 1 2 2 2 2
4
1 1 2 2
2
1 1
4
1 1 1 3
4
1 1 1 3
4
1 1 1 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
...

result:

wrong answer 18283rd words differ - expected: 'Yes', found: 'No'