Submission #926618

# Submission time Handle Problem Language Result Execution time Memory
926618 2024-02-13T12:40:21 Z VMaksimoski008 Art Exhibition (JOI18_art) C++14
Compilation error
0 ms 0 KB
v#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
    int n, i;
    cin >> n;
 
    vector<array<ll, 2> > v(n+1);
    for(i=1; i<=n; i++) cin >> v[i][0] >> v[i][1];
    sort(v.begin()+1, v.end());
 
    ll A = 0, M = -1e18, S = 0;
    for(i=1; i<=n; i++) {
        M = max(M, v[i][0] - S);
        S += v[i][1];
        A = max(A, S - v[i][0] + M);
    }
 
    cout << A << '\n';
}

Compilation message

art.cpp:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
art.cpp:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
art.cpp: In function 'int main()':
art.cpp:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n;
      |     ^~~
art.cpp:9:5: error: 'vector' was not declared in this scope
    9 |     vector<array<ll, 2> > v(n+1);
      |     ^~~~~~
art.cpp:9:12: error: 'array' was not declared in this scope
    9 |     vector<array<ll, 2> > v(n+1);
      |            ^~~~~
art.cpp:9:20: error: expected primary-expression before ',' token
    9 |     vector<array<ll, 2> > v(n+1);
      |                    ^
art.cpp:9:25: error: expected primary-expression before '>' token
    9 |     vector<array<ll, 2> > v(n+1);
      |                         ^
art.cpp:9:27: error: 'v' was not declared in this scope
    9 |     vector<array<ll, 2> > v(n+1);
      |                           ^
art.cpp:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(v.begin()+1, v.end());
      |     ^~~~
      |     short
art.cpp:15:13: error: 'max' was not declared in this scope
   15 |         M = max(M, v[i][0] - S);
      |             ^~~
art.cpp:20:5: error: 'cout' was not declared in this scope
   20 |     cout << A << '\n';
      |     ^~~~