aboutsummaryrefslogtreecommitdiff
path: root/codeforces/Tram
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2022-11-10 16:05:26 +0200
committeromagdy7 <omar.professional8777@gmail.com>2022-11-10 16:05:26 +0200
commit95422138588572e08a1ee78e654741874f11cfa0 (patch)
tree1a03ad9c57788546e804724ed4507f46c385263d /codeforces/Tram
parent42e25addbbce62e8bb43ab587b21c5bccb495bfb (diff)
downloadcompetitive-programming-95422138588572e08a1ee78e654741874f11cfa0.tar.xz
competitive-programming-95422138588572e08a1ee78e654741874f11cfa0.zip
Added some new problems
Diffstat (limited to 'codeforces/Tram')
-rwxr-xr-xcodeforces/Tram/mainbin0 -> 27800 bytes
-rw-r--r--codeforces/Tram/main.cpp28
-rw-r--r--codeforces/Tram/main_input0.txt5
-rw-r--r--codeforces/Tram/main_output0.txt1
4 files changed, 34 insertions, 0 deletions
diff --git a/codeforces/Tram/main b/codeforces/Tram/main
new file mode 100755
index 0000000..3c01372
--- /dev/null
+++ b/codeforces/Tram/main
Binary files differ
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<bits/stdc++.h>
+
+using namespace std;
+
+typedef long long ll;
+typedef pair<int, int> ii;
+typedef vector<ii> vii;
+typedef vector<int> 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';
+}
diff --git a/codeforces/Tram/main_input0.txt b/codeforces/Tram/main_input0.txt
new file mode 100644
index 0000000..4a49cc9
--- /dev/null
+++ b/codeforces/Tram/main_input0.txt
@@ -0,0 +1,5 @@
+4
+0 3
+2 5
+4 2
+4 0
diff --git a/codeforces/Tram/main_output0.txt b/codeforces/Tram/main_output0.txt
new file mode 100644
index 0000000..1e8b314
--- /dev/null
+++ b/codeforces/Tram/main_output0.txt
@@ -0,0 +1 @@
+6