ARC 149
Table of Contents
A. Repdigit Number
https://atcoder.jp/contests/arc149/tasks/arc149_a
自力 AC
void solve() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll N, M;
cin >> N >> M;
modint::set_mod(M);
using mint = modint;
auto chmin_string = [](string& a, string& b) -> void {
if (a.size() > b.size()) return;
if (a.size() < b.size()) {
a = b;
return;
}
if (a < b) a = b;
};
string ans = "";
rep2(i, 1, 10) {
string s = "";
mint x = 0;
rep(j, N) {
x *= 10;
x += i;
s.push_back('0' + i);
if (x == 0) chmin_string(ans, s);
}
}
if (ans == "") ans = "-1";
cout << ans << endl;
}
B. Two LIS Sum
https://atcoder.jp/contests/arc149/tasks/arc149_b
実験していて $A_i$ で sort して $B_i$ の LIS を求めるだけで良さそうだなと思って実装したら AC した。
void solve() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<int, int>> ps(n);
rep(i, n) {
int x;
cin >> x;
ps[i].first = x;
}
rep(i, n) {
int x;
cin >> x;
ps[i].second = x;
}
sort(all(ps));
ll ans = n;
vint v(n + 1, INF);
rep(i, n) {
auto it = upper_bound(all(v), ps[i].second);
*it = ps[i].second;
}
ans += lower_bound(all(v), INF) - v.begin();
cout << ans << endl;
}
C. Avoid Prime Sum
https://atcoder.jp/contests/arc149/tasks/arc149_c
D. Simultaneous Sugoroku
https://atcoder.jp/contests/arc149/tasks/arc149_d
E. Sliding Window Sort
https://atcoder.jp/contests/arc149/tasks/arc149_e