From 95422138588572e08a1ee78e654741874f11cfa0 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Thu, 10 Nov 2022 16:05:26 +0200 Subject: Added some new problems --- codeforces/Tram/main.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 codeforces/Tram/main.cpp (limited to 'codeforces/Tram/main.cpp') diff --git a/codeforces/Tram/main.cpp b/codeforces/Tram/main.cpp new file mode 100644 index 0000000..ff917a6 --- /dev/null +++ b/codeforces/Tram/main.cpp @@ -0,0 +1,28 @@ +#include + +using namespace std; + +typedef long long ll; +typedef pair ii; +typedef vector vii; +typedef vector vi; + +#define INF 1000000000 + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int mx = 0; + int n; + cin >> n; + vi v(n); + int x, y; + cin >> x >> y; + v[0] = y; + for (int i = 0; i < n - 1; ++i) { + int x, y; + cin >> x >> y; + v[i + 1] = v[i] + (y - x); + } + cout << *max_element(v.begin(), v.end()) << '\n'; +} -- cgit v1.2.3