QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#584138#9313. Make MaxEnigmaWA 46ms4348kbC++234.2kb2024-09-23 09:10:232024-09-23 09:10:23

Judging History

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

  • [2024-09-23 09:10:23]
  • 评测
  • 测评结果:WA
  • 用时:46ms
  • 内存:4348kb
  • [2024-09-23 09:10:23]
  • 提交

answer

// #define NDEBUG

#define ce constexpr
#define tt template <typename T>
#define tt_ template <typename... T>
#define tn template <size_t N>
#define bs binary_search
#define ps partial_sum
#define ad adjacent_difference
#define rc reverse_copy
#define nthe nth_element
#define maxe max_element
#define mine min_element
#define np next_permutation
#define pp prev_permutation
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define whole(x) (x).begin(), (x).end()
#define rwhole(x) (x).rbegin(), (x).rend()

#include <bits/stdc++.h>
// #include <bits/extc++.h>

using ll = long long;
using lll = __int128_t;
using ld = long double;
using uchar = unsigned char;
using ushort = unsigned short;
using uint = unsigned int;
using ull = unsigned long long;
using ulll = __uint128_t;
ce int mod9 = 998244353;
ce int mod10 = 1000000007;
ce int inf = 0x3f3f3f3f;
ce int neginf = 0xc0c0c0c0;
ce ll infll = 0x3f3f3f3f3f3f3f3f;
ce ll neginfll = 0xc0c0c0c0c0c0c0c0;
tt ce T &maxeq(T &a, const T &b) { return a < b ? (a = b) : a; }
tt ce T &mineq(T &a, const T &b) { return a > b ? (a = b) : a; }
ce int mylog(uint x) { return 31 - __builtin_clz(x); }
ce int mylogll(ull x) { return 63 - __builtin_clzll(x); }

using namespace std;
tt_ using vec = vector<T...>;
tt_ using mset = multiset<T...>;
tt_ using mmap = multimap<T...>;
tt_ using uset = unordered_set<T...>;
tt_ using umap = unordered_map<T...>;
tt_ using umset = unordered_multiset<T...>;
tt_ using ummap = unordered_multimap<T...>;
tt_ using pq = priority_queue<T...>;
tt_ using ii = istream_iterator<T...>;
tt_ using oi = ostream_iterator<T...>;
using pbb = pair<bool, bool>;
using pbi = pair<bool, int>;
using pbd = pair<bool, double>;
using pib = pair<int, bool>;
using pii = pair<int, int>;
using pid = pair<int, double>;
using pdb = pair<double, bool>;
using pdi = pair<double, int>;
using pdd = pair<double, double>;
using vb = vec<bool>;
using vbr = vb::reference;
using vbp = vb::pointer;
using vbt = vb::iterator;
using vbrt = vb::reverse_iterator;
using vvb = vec<vb>;
using vi = vec<int>;
using vit = vi::iterator;
using virt = vi::reverse_iterator;
using vvi = vec<vi>;
using vd = vec<double>;
using vdt = vd::iterator;
using vdrt = vd::reverse_iterator;
using vvd = vec<vd>;
using vpii = vec<pii>;
using vpiit = vpii::iterator;
using vpiirt = vpii::reverse_iterator;
using vvpii = vec<vpii>;
using vs = vec<string>;
using vst = vs::iterator;
using vsrt = vs::reverse_iterator;
using vvs = vec<vs>;
using gbool = greater<bool>;
using gint = greater<int>;
using gdouble = greater<double>;
using gpii = greater<pii>;
using gstring = greater<string>;
inline vbr operator^=(vbr a, const bool &b) { return a = a ^ b; }
inline vbr operator&=(vbr a, const bool &b) { return a = a && b; }
inline vbr operator|=(vbr a, const bool &b) { return a = a || b; }
tn inline bitset<N>::reference operator^=(typename bitset<N>::reference a, const bool &b) { return a = a ^ b; }
tn inline bitset<N>::reference operator&=(typename bitset<N>::reference a, const bool &b) { return a = a && b; }
tn inline bitset<N>::reference operator|=(typename bitset<N>::reference a, const bool &b) { return a = a || b; }
tn inline void swap(typename bitset<N>::reference a, typename bitset<N>::reference b)
{
    a ^= b;
    b ^= a;
    a ^= b;
}

// template <typename S, typename T>
// using rbtree = __gnu_pbds::tree<S, __gnu_pbds::null_type, T, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

#undef tt
#undef tt_
#undef tn

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vi a(n);
        for (int &i : a)
            cin >> i;
        sort(whole(a));
        int ans{};
        for (int i{};;)
        {
            int now{a[i]};
            while (i < n && a[i] == now)
                ++i;
            if (i == n)
                break;
            ans += i;
        }
        cout << ans << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
2
1 2
2
2 2
7
1 1 1 2 2 2 2
3
1 2 3

output:

1
0
3
3

result:

ok 4 number(s): "1 0 3 3"

Test #2:

score: -100
Wrong Answer
time: 46ms
memory: 4348kb

input:

2
198018
875421126 585870339 471894633 383529988 625397685 944061047 704695631 105113224 459022561 760848605 980735314 847376362 980571959 329939331 644635272 326439858 752879510 837384394 175179068 182094523 397239381 1199016 185143405 279638454 252374970 822030887 860312140 137248166 993229443 164...

output:

-1871121288
1010448805

result:

wrong answer 1st numbers differ - expected: '4084978', found: '-1871121288'