UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#215331#2713. 8.2t2ThySecretCompile Error//C++111.6kb2024-11-28 19:05:092024-11-28 23:10:24

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
// #define x first
// #define y second
#define File(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)

inline void debug() { cerr << '\n'; }
template<typename Type, typename... Other>
inline void debug(const Type& x, const Other&... y) { cerr << x << ' '; debug(y...); }
#define DEBUG(a...) cerr << "[" << #a << "] = ", debug(a);

typedef long long LL;
typedef pair<int, int> PII;

const int N = 3000010;
const int INF = 0x3f3f3f3f;

template<typename Type>
inline void read(Type &res)
{
    res = 0;
    int ch = getchar(), flag = 0;
    while (!isdigit(ch)) flag |= ch == '-', ch = getchar();
    while (isdigit(ch)) res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
    res = flag ? -res : res;
}
template<typename Type, typename... Other>
inline void read(Type &res, Other&... y) { read(res), read(y...); }

int n, m;
int a[N], b[N], ans;
int dp[N], idx[N], idy[N];

signed main()
{
    read(n, m);
    for (int i = 1; i <= n; i ++) read(a[i]);
    for (int i = 1; i <= n; i ++) read(b[i]), b[i] += a[i];
    sort(a + 1, a + 1 + n, greater<>()), sort(b + 1, b + 1 + n, greater<>());

    idx[0] = idy[0] = 1;
    for (int i = 0; i <= m; i ++)
    {
        ans ^= dp[i];
        if (idx[i] <= n && dp[i] + a[idx[i]] > dp[i + 1])
            dp[i + 1] = dp[i] + a[idx[i]], idx[i + 1] = idx[i] + 1, idy[i + 1] = idy[i];
        if (idy[i] <= n && dp[i] + b[idy[i]] > dp[i + 2])
            dp[i + 2] = dp[i] + b[idy[i]], idy[i + 2] = idy[i] + 1, idx[i + 2] = idx[i];
    }
    cout << ans << '\n';
}

详细

answer.code: In function 'int main()':
answer.code:42:36: error: wrong number of template arguments (0, should be 1)
     sort(a + 1, a + 1 + n, greater<>()), sort(b + 1, b + 1 + n, greater<>());\x0d
                                    ^
In file included from /usr/include/c++/4.8/string:48:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr...