Skip to content

Commit f5f63b4

Browse files
authored
Merge pull request #402 from xirc/atcoder/abc077
AtCoder/ABC077
2 parents 6c2198c + 921bd0c commit f5f63b4

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

atcoder/abc077/A/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int main() {
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(0); cout.tie(0);
10+
11+
string c1, c2;
12+
cin >> c1 >> c2;
13+
bool pass = (c1[0] == c2[2] && c2[0] == c1[2] && c1[1] == c2[1]);
14+
cout << (pass ? "YES" : "NO") << endl;
15+
16+
return 0;
17+
}

atcoder/abc077/B/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int main() {
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(0); cout.tie(0);
10+
11+
int N;
12+
cin >> N;
13+
int M = round(floor(sqrt(N)));
14+
cout << (M * M) << endl;
15+
16+
return 0;
17+
}

atcoder/abc077/C/main.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int main() {
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(0); cout.tie(0);
10+
11+
int N;
12+
cin >> N;
13+
14+
vector<int> A(N), B(N), C(N);
15+
for (auto &a : A) cin >> a;
16+
for (auto &b : B) cin >> b;
17+
for (auto &c : C) cin >> c;
18+
sort(A.begin(), A.end());
19+
sort(B.begin(), B.end());
20+
sort(C.begin(), C.end());
21+
22+
ll ans = 0;
23+
for (int i = 0; i < N; ++i) {
24+
auto ita = lower_bound(A.begin(), A.end(), B[i]);
25+
int sa = distance(A.begin(), ita);
26+
auto itb = upper_bound(C.begin(), C.end(), B[i]);
27+
int sb = distance(itb, C.end());
28+
ans += ll(sa) * sb;
29+
}
30+
cout << ans << endl;
31+
32+
return 0;
33+
}

0 commit comments

Comments
 (0)