답안 #1073923

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1073923 2024-08-25T03:39:17 Z NoLove 조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2) C++14
컴파일 오류
0 ms 0 KB
/**
 *    author : Lăng Trọng Đạt
 *    created: 2024-08-25
**/
#include <bits/stdc++.h>
using namespace std;
#ifndef LANG_DAT
#define db(...) ;
#endif // LANG_DAT
#define int long long
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
using pii = pair<int, int>;
using vi = vector<int>;
#define FOR(i, a, b) for (int i = a; (i) <= (b); i++)
void mx(int& a, int b) { if (b > a) a = b; }
void mi(int& a, int b) { if (b < a) a = b; }
#define si(x) (int)(x.size())
const int INF = 1e18;
const int MOD = 1e9 + 7;

const int N = 2e5 + 5;
int g[N];
int n, m, k, a, b;

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    if (fopen("hi.inp", "r")) {
        freopen("hi.inp", "r", stdin);
//        freopen("hi.out", "w", stdout);
    }

    cin >> n >> m;
    vector<pii> p(n);
    for (auto&[c, v] : p) cin >> v >> c;
    sort(all(p

    int ans = -INF;
    db(p)
    FOR(i, 0, n - 1) {
        db(p[i])
        if (i + m > n) break;
        int total = p[i].se;
        multiset<int> val;
        for (int j = i + 1; j < i + m - 1; j++) {
            val.insert(p[j].se);
            total += p[j].se;
        }
        db(i, i + m -1)
        db(val, total)
        for (int j = i + m - 1; j < n; j++) {
            val.insert(p[j].se);
            total += p[j].se;
            mx(ans, total - 2*(p[j].f - p[i].f));
            db(j, total, p[j], ans)

            total -= *val.begin();
            val.erase(val.begin());
        }
    }

    cout << ans;
}

Compilation message

joitter2.cpp:67: error: unterminated argument list invoking macro "all"
joitter2.cpp: In function 'int32_t main()':
joitter2.cpp:38:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   38 |     for (auto&[c, v] : p) cin >> v >> c;
      |               ^
joitter2.cpp:39:10: error: 'all' was not declared in this scope
   39 |     sort(all(p
      |          ^~~
joitter2.cpp:39:10: error: expected '}' at end of input
joitter2.cpp:29:16: note: to match this '{'
   29 | int32_t main() {
      |                ^
joitter2.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen("hi.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~