diff --git a/src/abc303/A/in_1.txt b/src/abc303/A/in_1.txt new file mode 100644 index 0000000..caaa365 --- /dev/null +++ b/src/abc303/A/in_1.txt @@ -0,0 +1,3 @@ +3 +l0w +1ow diff --git a/src/abc303/A/in_2.txt b/src/abc303/A/in_2.txt new file mode 100644 index 0000000..2be0b77 --- /dev/null +++ b/src/abc303/A/in_2.txt @@ -0,0 +1,3 @@ +3 +abc +arc diff --git a/src/abc303/A/in_3.txt b/src/abc303/A/in_3.txt new file mode 100644 index 0000000..8a1bb8a --- /dev/null +++ b/src/abc303/A/in_3.txt @@ -0,0 +1,3 @@ +4 +nok0 +n0ko diff --git a/src/abc303/A/main b/src/abc303/A/main new file mode 100755 index 0000000..b0b7b80 Binary files /dev/null and b/src/abc303/A/main differ diff --git a/src/abc303/A/main.cpp b/src/abc303/A/main.cpp new file mode 100644 index 0000000..d364af4 --- /dev/null +++ b/src/abc303/A/main.cpp @@ -0,0 +1,44 @@ + #include "bits/stdc++.h" + +using namespace std; + +#define sp(x) cout< P; + +int main(){ + ios::sync_with_stdio(false); + cin.tie(0); + int n; cin>>n; + string s, t; cin>>s>>t; + bool flag = true; + REP(i, n){ + if(s[i] != t[i]){ + if(s[i] == '0'){ + if(t[i] == 'o') continue; + } + else if(s[i] == '1'){ + if(t[i] == 'l') continue; + } + else if(s[i] == 'o'){ + if(t[i] == '0') continue; + } + else if(s[i] == 'l'){ + if(t[i] == '1') continue; + } + else flag = false; + } + } + if(flag) cout << "Yes" < P; + +int main(){ + ios::sync_with_stdio(false); + cin.tie(0); + int n, m; cin>>n>>m; + vector > memo(n); + REP(i, n){ + REP(j, n){ + memo[i].push_back(1); + } + } + vector > a(m); + REP(i, m){ + REP(j, n){ + int in; cin>>in; + a[i].push_back(in - 1); + } + } + REP(i, m){ + REP(j, n){ + if(j - 1 < 0){ + memo[a[i][j]][a[i][j + 1]] = 0; + memo[a[i][j + 1]][a[i][j]] = 0; + } + else if(j + 1 >= n){ + memo[a[i][j]][a[i][j - 1]] = 0; + memo[a[i][j - 1]][a[i][j]] = 0; + } + else { + memo[a[i][j]][a[i][j - 1]] = 0; + memo[a[i][j - 1]][a[i][j]] = 0; + memo[a[i][j]][a[i][j + 1]] = 0; + memo[a[i][j + 1]][a[i][j]] = 0; + } + } + } + int ans = 0; + REP(i, n){ + REP(j, n){ + // cout << memo[i][j]; + if(i == j) continue; + ans+=memo[i][j]; + } + // cout << endl; + } + cout << ans / 2 << endl; + return 0; +} diff --git a/src/abc303/B/metadata.json b/src/abc303/B/metadata.json new file mode 100644 index 0000000..0ff214e --- /dev/null +++ b/src/abc303/B/metadata.json @@ -0,0 +1,17 @@ +{ + "code_filename": "main.cpp", + "judge": { + "judge_type": "normal" + }, + "lang": "cpp", + "problem": { + "alphabet": "B", + "contest": { + "contest_id": "abc303" + }, + "problem_id": "abc303_b" + }, + "sample_in_pattern": "in_*.txt", + "sample_out_pattern": "out_*.txt", + "timeout_ms": 2000 +} diff --git a/src/abc303/B/out_1.txt b/src/abc303/B/out_1.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/src/abc303/B/out_1.txt @@ -0,0 +1 @@ +2 diff --git a/src/abc303/B/out_2.txt b/src/abc303/B/out_2.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/src/abc303/B/out_2.txt @@ -0,0 +1 @@ +0 diff --git a/src/abc303/B/out_3.txt b/src/abc303/B/out_3.txt new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/src/abc303/B/out_3.txt @@ -0,0 +1 @@ +6 diff --git a/src/abc303/C/in_1.txt b/src/abc303/C/in_1.txt new file mode 100644 index 0000000..7463b25 --- /dev/null +++ b/src/abc303/C/in_1.txt @@ -0,0 +1,4 @@ +4 2 3 1 +RUDL +-1 -1 +1 0 diff --git a/src/abc303/C/in_2.txt b/src/abc303/C/in_2.txt new file mode 100644 index 0000000..d3d54e0 --- /dev/null +++ b/src/abc303/C/in_2.txt @@ -0,0 +1,4 @@ +5 2 1 5 +LDRLD +0 0 +-1 -1 diff --git a/src/abc303/C/main b/src/abc303/C/main new file mode 100755 index 0000000..e7762f3 Binary files /dev/null and b/src/abc303/C/main differ diff --git a/src/abc303/C/main.cpp b/src/abc303/C/main.cpp new file mode 100644 index 0000000..83bba2a --- /dev/null +++ b/src/abc303/C/main.cpp @@ -0,0 +1,60 @@ + #include "bits/stdc++.h" + +using namespace std; + +#define sp(x) cout< P; + +int n, m, h, k; +string s; +map ma; +int main(){ + ios::sync_with_stdio(false); + cin.tie(0); + cin>>n>>m>>h>>k; + cin>>s; + vector a(n); + REP(i, n){ + if(s[i] == 'R') a[i] = 0; + if(s[i] == 'L') a[i] = 1; + if(s[i] == 'U') a[i] = 2; + if(s[i] == 'D') a[i] = 3; + } + + REP(i, m){ + int x, y; cin>>x>>y; + ma[make_pair(x, y)] = 1; + } + int curx = 0, cury = 0; + int dx[4] = {1, -1, 0, 0}; + int dy[4] = {0, 0, 1, -1}; + int curh = h; + int flag = true; + REP(i, n){ + curx += dx[a[i]], cury += dy[a[i]]; + curh--; + // cout << curx << cury << endl; + if(curh < 0){ + flag = false; + break; + } else { + if(ma[make_pair(curx, cury)] == 1 && curh < k){ + curh = k; + ma[make_pair(curx, cury)] = 0; + } + } + } + if(flag) cout << "Yes" << endl; + else cout << "No" << endl; + return 0; +} diff --git a/src/abc303/C/metadata.json b/src/abc303/C/metadata.json new file mode 100644 index 0000000..c722a26 --- /dev/null +++ b/src/abc303/C/metadata.json @@ -0,0 +1,17 @@ +{ + "code_filename": "main.cpp", + "judge": { + "judge_type": "normal" + }, + "lang": "cpp", + "problem": { + "alphabet": "C", + "contest": { + "contest_id": "abc303" + }, + "problem_id": "abc303_c" + }, + "sample_in_pattern": "in_*.txt", + "sample_out_pattern": "out_*.txt", + "timeout_ms": 2000 +} diff --git a/src/abc303/C/out_1.txt b/src/abc303/C/out_1.txt new file mode 100644 index 0000000..dcd7a5d --- /dev/null +++ b/src/abc303/C/out_1.txt @@ -0,0 +1 @@ +Yes diff --git a/src/abc303/C/out_2.txt b/src/abc303/C/out_2.txt new file mode 100644 index 0000000..cf45697 --- /dev/null +++ b/src/abc303/C/out_2.txt @@ -0,0 +1 @@ +No diff --git a/src/abc303/D/in_1.txt b/src/abc303/D/in_1.txt new file mode 100644 index 0000000..7404c5e --- /dev/null +++ b/src/abc303/D/in_1.txt @@ -0,0 +1,2 @@ +1 3 3 +AAaA diff --git a/src/abc303/D/in_2.txt b/src/abc303/D/in_2.txt new file mode 100644 index 0000000..2c7b90a --- /dev/null +++ b/src/abc303/D/in_2.txt @@ -0,0 +1,2 @@ +1 1 100 +aAaAaA diff --git a/src/abc303/D/in_3.txt b/src/abc303/D/in_3.txt new file mode 100644 index 0000000..67fac56 --- /dev/null +++ b/src/abc303/D/in_3.txt @@ -0,0 +1,2 @@ +1 2 4 +aaAaAaaAAAAaAaaAaAAaaaAAAAA diff --git a/src/abc303/D/main b/src/abc303/D/main new file mode 100755 index 0000000..a5055bd Binary files /dev/null and b/src/abc303/D/main differ diff --git a/src/abc303/D/main.cpp b/src/abc303/D/main.cpp new file mode 100644 index 0000000..5047e62 --- /dev/null +++ b/src/abc303/D/main.cpp @@ -0,0 +1,68 @@ +#include "bits/stdc++.h" + +using namespace std; + +#define sp(x) cout << setprecision(x); +#define FOR(i, a, b) for (int i = (a); i < (b); i++) +#define REP(i, n) FOR(i, 0, n) +#define all(a) (a).begin(), (a).end() +#define linf INT64_MAX * 0.99 +#define print(s) cout << (s) << endl +#define lint long long +#define yes "Yes" +#define no "No" +template +inline bool chmin(T &a, T b) +{ + if (a > b) + { + a = b; + return true; + } + return false; +} +template +inline bool chmax(T &a, T b) +{ + if (a < b) + { + a = b; + return true; + } + return false; +} + +typedef pair P; + +int main() +{ + ios::sync_with_stdio(false); + cin.tie(0); + lint x, y, z; + cin >> x >> y >> z; + string s; + cin >> s; + lint dp[s.length() + 1][2]; + REP(i, s.length() + 1) + REP(j, 2) dp[i][j] = linf; + REP(i, s.length() + 1) + dp[0][0] = 0; + REP(i, s.length()) + { + chmin(dp[i][0], dp[i][1] + z); + chmin(dp[i][1], dp[i][0] + z); + + if (s[i] == 'a') + { + chmin(dp[i + 1][0], dp[i][0] + x); + chmin(dp[i + 1][1], dp[i][1] + y); + } + else + { + chmin(dp[i + 1][0], dp[i][0] + y); + chmin(dp[i + 1][1], dp[i][1] + x); + } + } + cout << min(dp[s.length()][0], dp[s.length()][1]) << endl; + return 0; +} diff --git a/src/abc303/D/metadata.json b/src/abc303/D/metadata.json new file mode 100644 index 0000000..b67b4f3 --- /dev/null +++ b/src/abc303/D/metadata.json @@ -0,0 +1,17 @@ +{ + "code_filename": "main.cpp", + "judge": { + "judge_type": "normal" + }, + "lang": "cpp", + "problem": { + "alphabet": "D", + "contest": { + "contest_id": "abc303" + }, + "problem_id": "abc303_d" + }, + "sample_in_pattern": "in_*.txt", + "sample_out_pattern": "out_*.txt", + "timeout_ms": 2000 +} diff --git a/src/abc303/D/out_1.txt b/src/abc303/D/out_1.txt new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/src/abc303/D/out_1.txt @@ -0,0 +1 @@ +9 diff --git a/src/abc303/D/out_2.txt b/src/abc303/D/out_2.txt new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/src/abc303/D/out_2.txt @@ -0,0 +1 @@ +6 diff --git a/src/abc303/D/out_3.txt b/src/abc303/D/out_3.txt new file mode 100644 index 0000000..425151f --- /dev/null +++ b/src/abc303/D/out_3.txt @@ -0,0 +1 @@ +40