aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMarkTheDustSweeper/mainbin0 -> 27320 bytes
-rw-r--r--MarkTheDustSweeper/main.cpp39
-rw-r--r--MarkTheDustSweeper/main_input0.txt9
-rw-r--r--MarkTheDustSweeper/main_output0.txt4
-rwxr-xr-xMarkThePhotographer/mainbin0 -> 44912 bytes
-rw-r--r--MarkThePhotographer/main.cpp31
-rw-r--r--MarkThePhotographer/main_input0.txt7
-rw-r--r--MarkThePhotographer/main_output0.txt3
-rwxr-xr-xyapapsai/mainbin0 -> 32512 bytes
-rw-r--r--yapapsai/main.cpp26
-rw-r--r--yapapsai/main_input0.txt11
-rw-r--r--yapapsai/main_output0.txt5
12 files changed, 135 insertions, 0 deletions
diff --git a/MarkTheDustSweeper/main b/MarkTheDustSweeper/main
new file mode 100755
index 0000000..0ceccde
--- /dev/null
+++ b/MarkTheDustSweeper/main
Binary files differ
diff --git a/MarkTheDustSweeper/main.cpp b/MarkTheDustSweeper/main.cpp
new file mode 100644
index 0000000..6335886
--- /dev/null
+++ b/MarkTheDustSweeper/main.cpp
@@ -0,0 +1,39 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n;
+ cin >> n;
+ long long ans = 0;
+ vector<int> v(n);
+ long long sum = 0;
+ for (auto &x : v) {
+ cin >> x;
+ sum += x;
+ }
+ if(sum != v[n - 1]) {
+ int ind;
+ for(int i = 0; i < n; i++) {
+ if(v[i] != 0) {
+ ind = i;
+ break;
+ }
+ }
+ for(int i = ind; i < n - 1; i++) {
+ if(v[i] == 0) {
+ ans += 1;
+ } else{
+ ans += v[i];
+ }
+ }
+ }
+ cout << ans << endl;
+ }
+}
diff --git a/MarkTheDustSweeper/main_input0.txt b/MarkTheDustSweeper/main_input0.txt
new file mode 100644
index 0000000..ad05cd8
--- /dev/null
+++ b/MarkTheDustSweeper/main_input0.txt
@@ -0,0 +1,9 @@
+4
+3
+2 0 0
+5
+0 2 0 2 0
+6
+2 0 3 0 4 6
+4
+0 0 0 10
diff --git a/MarkTheDustSweeper/main_output0.txt b/MarkTheDustSweeper/main_output0.txt
new file mode 100644
index 0000000..0c8b213
--- /dev/null
+++ b/MarkTheDustSweeper/main_output0.txt
@@ -0,0 +1,4 @@
+3
+5
+11
+0
diff --git a/MarkThePhotographer/main b/MarkThePhotographer/main
new file mode 100755
index 0000000..eaaf214
--- /dev/null
+++ b/MarkThePhotographer/main
Binary files differ
diff --git a/MarkThePhotographer/main.cpp b/MarkThePhotographer/main.cpp
new file mode 100644
index 0000000..15c4e29
--- /dev/null
+++ b/MarkThePhotographer/main.cpp
@@ -0,0 +1,31 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n, y;
+ cin >> n >> y;
+ vector<int> v(2 * n);
+ int ans = 0;
+ for (int &x : v)
+ cin >> x;
+ sort(v.begin(), v.end());
+ for (int i = 0; i < n; i++) {
+ int x = v[i];
+ int z = v[i + n];
+ if (z - x >= y) {
+ ans++;
+ }
+ }
+ if (ans == n) {
+ cout << "YES" << '\n';
+ } else {
+ cout << "NO" << '\n';
+ }
+ }
+}
diff --git a/MarkThePhotographer/main_input0.txt b/MarkThePhotographer/main_input0.txt
new file mode 100644
index 0000000..3e55cb5
--- /dev/null
+++ b/MarkThePhotographer/main_input0.txt
@@ -0,0 +1,7 @@
+3
+3 6
+1 3 9 10 12 16
+3 1
+2 5 2 2 2 5
+1 2
+8 6
diff --git a/MarkThePhotographer/main_output0.txt b/MarkThePhotographer/main_output0.txt
new file mode 100644
index 0000000..0db7433
--- /dev/null
+++ b/MarkThePhotographer/main_output0.txt
@@ -0,0 +1,3 @@
+YES
+NO
+YES
diff --git a/yapapsai/main b/yapapsai/main
new file mode 100755
index 0000000..a26e653
--- /dev/null
+++ b/yapapsai/main
Binary files differ
diff --git a/yapapsai/main.cpp b/yapapsai/main.cpp
new file mode 100644
index 0000000..2946e65
--- /dev/null
+++ b/yapapsai/main.cpp
@@ -0,0 +1,26 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n;
+ cin >> n;
+ vector<int> pos;
+ long long ans = 0;
+ for (int i = 1; i <= n; i++) {
+ int x;
+ cin >> x;
+ if (x < i) {
+ auto it = lower_bound(pos.begin(), pos.end(), x);
+ ans += it - pos.begin();
+ pos.emplace_back(i);
+ }
+ }
+ cout << ans << '\n';
+ }
+}
diff --git a/yapapsai/main_input0.txt b/yapapsai/main_input0.txt
new file mode 100644
index 0000000..bb1b141
--- /dev/null
+++ b/yapapsai/main_input0.txt
@@ -0,0 +1,11 @@
+5
+8
+1 1 2 3 8 2 1 4
+2
+1 2
+10
+0 2 1 6 3 4 1 2 8 3
+2
+1 1000000000
+3
+0 1000000000 2
diff --git a/yapapsai/main_output0.txt b/yapapsai/main_output0.txt
new file mode 100644
index 0000000..5859aa7
--- /dev/null
+++ b/yapapsai/main_output0.txt
@@ -0,0 +1,5 @@
+3
+0
+10
+0
+1