제출 #715745

#제출 시각아이디문제언어결과실행 시간메모리
715745aykhnArt Exhibition (JOI18_art)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ll;

#define OPT ios_base::sync_with_stdio(0); \
            cin.tie(0); \
            cout.tie(0)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define pull pair<ull,ull>
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) \
                    cout << v[i] << " "; \
                    cout<<endl;

int main()
{
    int n;
    cin >> n;

    vector<pull> v(n);

    ull res = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> v[i].fi >> v[i].se;
        res = max(res, v[i].se);
    }

    sort(all(v));

    ull sum = 0;

    for (int i = 0; i < n; i++)
    {
        sum += v[i].se;

        res = max(res, sum - v[i].fi + v[0].fi);
    }

    cout << res << endl;
}

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

art.cpp:6:28: error: conflicting declaration 'typedef long long unsigned int ll'
    6 | typedef unsigned long long ll;
      |                            ^~
art.cpp:5:19: note: previous declaration as 'typedef long long int ll'
    5 | typedef long long ll;
      |                   ^~
art.cpp: In function 'int main()':
art.cpp:14:19: error: 'ull' was not declared in this scope; did you mean 'll'?
   14 | #define pull pair<ull,ull>
      |                   ^~~
art.cpp:33:12: note: in expansion of macro 'pull'
   33 |     vector<pull> v(n);
      |            ^~~~
art.cpp:14:26: error: template argument 1 is invalid
   14 | #define pull pair<ull,ull>
      |                          ^
art.cpp:33:12: note: in expansion of macro 'pull'
   33 |     vector<pull> v(n);
      |            ^~~~
art.cpp:33:16: error: template argument 1 is invalid
   33 |     vector<pull> v(n);
      |                ^
art.cpp:33:16: error: template argument 2 is invalid
art.cpp:35:8: error: expected ';' before 'res'
   35 |     ull res = 0;
      |        ^~~~
      |        ;
art.cpp:39:17: error: invalid types 'int[int]' for array subscript
   39 |         cin >> v[i].fi >> v[i].se;
      |                 ^
art.cpp:39:28: error: invalid types 'int[int]' for array subscript
   39 |         cin >> v[i].fi >> v[i].se;
      |                            ^
art.cpp:40:9: error: 'res' was not declared in this scope
   40 |         res = max(res, v[i].se);
      |         ^~~
art.cpp:40:25: error: invalid types 'int[int]' for array subscript
   40 |         res = max(res, v[i].se);
      |                         ^
art.cpp:16:18: error: request for member 'begin' in 'v', which is of non-class type 'int'
   16 | #define all(v) v.begin(), v.end()
      |                  ^~~~~
art.cpp:43:10: note: in expansion of macro 'all'
   43 |     sort(all(v));
      |          ^~~
art.cpp:16:29: error: request for member 'end' in 'v', which is of non-class type 'int'
   16 | #define all(v) v.begin(), v.end()
      |                             ^~~
art.cpp:43:10: note: in expansion of macro 'all'
   43 |     sort(all(v));
      |          ^~~
art.cpp:45:8: error: expected ';' before 'sum'
   45 |     ull sum = 0;
      |        ^~~~
      |        ;
art.cpp:49:9: error: 'sum' was not declared in this scope
   49 |         sum += v[i].se;
      |         ^~~
art.cpp:49:17: error: invalid types 'int[int]' for array subscript
   49 |         sum += v[i].se;
      |                 ^
art.cpp:51:9: error: 'res' was not declared in this scope
   51 |         res = max(res, sum - v[i].fi + v[0].fi);
      |         ^~~
art.cpp:51:31: error: invalid types 'int[int]' for array subscript
   51 |         res = max(res, sum - v[i].fi + v[0].fi);
      |                               ^
art.cpp:51:41: error: invalid types 'int[int]' for array subscript
   51 |         res = max(res, sum - v[i].fi + v[0].fi);
      |                                         ^
art.cpp:54:13: error: 'res' was not declared in this scope
   54 |     cout << res << endl;
      |             ^~~