제출 #1353535

#제출 시각아이디문제언어결과실행 시간메모리
1353535goulthenSure Bet (CEOI17_sure)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define db double float
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,a,b) for (int i = a; i >= b; i--)
#define pii pair<int,int>
#define fi first
#define se second
#define endl '\n'
#define pb push_back
#define all(v) (v).begin(), (v).end()

const int MAXN = 5e5+10;
const int INF = 1e18+10;
const int MOD = 1e9+7;
db a[MAXN], b[MAXN];

void solve() {
    int n; cin >> n;
    rep(i,1,n) {
        cin >> a[i] >> b[i];
    }
    sort(a+1,a+n+1, greater<db>());
    sort(b+1,b+n+1, greater<db>());
    rep(i,1,n) a[i] += a[i-1];
    rep(i,1,n) b[i] += b[i-1];
    db ans = 0;
    rep(x,1,n) {
        rep(y,1,n) {
            db x1 = a[x],x2 = b[y];
            ans = max(ans,min(x2, x1)-x-y);
        }
    }

    cout << fixed << setprecision(4) << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
	int tt = 1;
    //cin >> tt;
    
    while(tt--) solve();
}

컴파일 시 표준 에러 (stderr) 메시지

sure.cpp:5:12: error: two or more data types in declaration of 'a'
    5 | #define db double float
      |            ^~~~~~
sure.cpp:18:1: note: in expansion of macro 'db'
   18 | db a[MAXN], b[MAXN];
      | ^~
sure.cpp:5:12: error: two or more data types in declaration of 'b'
    5 | #define db double float
      |            ^~~~~~
sure.cpp:18:1: note: in expansion of macro 'db'
   18 | db a[MAXN], b[MAXN];
      | ^~
sure.cpp: In function 'void solve()':
sure.cpp:23:16: error: 'a' was not declared in this scope
   23 |         cin >> a[i] >> b[i];
      |                ^
sure.cpp:23:24: error: 'b' was not declared in this scope
   23 |         cin >> a[i] >> b[i];
      |                        ^
sure.cpp:25:10: error: 'a' was not declared in this scope
   25 |     sort(a+1,a+n+1, greater<db>());
      |          ^
sure.cpp:5:12: error: two or more data types in declaration of 'type name'
    5 | #define db double float
      |            ^~~~~~
sure.cpp:25:29: note: in expansion of macro 'db'
   25 |     sort(a+1,a+n+1, greater<db>());
      |                             ^~
sure.cpp:25:31: error: template argument 1 is invalid
   25 |     sort(a+1,a+n+1, greater<db>());
      |                               ^
sure.cpp:26:10: error: 'b' was not declared in this scope
   26 |     sort(b+1,b+n+1, greater<db>());
      |          ^
sure.cpp:5:12: error: two or more data types in declaration of 'type name'
    5 | #define db double float
      |            ^~~~~~
sure.cpp:26:29: note: in expansion of macro 'db'
   26 |     sort(b+1,b+n+1, greater<db>());
      |                             ^~
sure.cpp:26:31: error: template argument 1 is invalid
   26 |     sort(b+1,b+n+1, greater<db>());
      |                               ^
sure.cpp:5:12: error: two or more data types in declaration of 'ans'
    5 | #define db double float
      |            ^~~~~~
sure.cpp:29:5: note: in expansion of macro 'db'
   29 |     db ans = 0;
      |     ^~
sure.cpp:5:12: error: two or more data types in declaration of 'x1'
    5 | #define db double float
      |            ^~~~~~
sure.cpp:32:13: note: in expansion of macro 'db'
   32 |             db x1 = a[x],x2 = b[y];
      |             ^~
sure.cpp:33:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |             ans = max(ans,min(x2, x1)-x-y);
      |             ^~~
      |             abs
sure.cpp:33:31: error: 'x2' was not declared in this scope; did you mean 'x'?
   33 |             ans = max(ans,min(x2, x1)-x-y);
      |                               ^~
      |                               x
sure.cpp:33:35: error: 'x1' was not declared in this scope; did you mean 'x'?
   33 |             ans = max(ans,min(x2, x1)-x-y);
      |                                   ^~
      |                                   x
sure.cpp:37:41: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |     cout << fixed << setprecision(4) << ans << endl;
      |                                         ^~~
      |                                         abs