Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/abc303/A/in_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3
l0w
1ow
3 changes: 3 additions & 0 deletions src/abc303/A/in_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3
abc
arc
3 changes: 3 additions & 0 deletions src/abc303/A/in_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
4
nok0
n0ko
Binary file added src/abc303/A/main
Binary file not shown.
44 changes: 44 additions & 0 deletions src/abc303/A/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#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 inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> 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" <<endl;
else cout << "No" << endl;
return 0;
}
17 changes: 17 additions & 0 deletions src/abc303/A/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"code_filename": "main.cpp",
"judge": {
"judge_type": "normal"
},
"lang": "cpp",
"problem": {
"alphabet": "A",
"contest": {
"contest_id": "abc303"
},
"problem_id": "abc303_a"
},
"sample_in_pattern": "in_*.txt",
"sample_out_pattern": "out_*.txt",
"timeout_ms": 2000
}
1 change: 1 addition & 0 deletions src/abc303/A/out_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Yes
1 change: 1 addition & 0 deletions src/abc303/A/out_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No
1 change: 1 addition & 0 deletions src/abc303/A/out_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Yes
3 changes: 3 additions & 0 deletions src/abc303/B/in_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
4 2
1 2 3 4
4 3 1 2
4 changes: 4 additions & 0 deletions src/abc303/B/in_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3 3
1 2 3
3 1 2
1 2 3
11 changes: 11 additions & 0 deletions src/abc303/B/in_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
10 10
4 10 7 2 8 3 9 1 6 5
3 6 2 9 1 8 10 7 4 5
9 3 4 5 7 10 1 8 2 6
7 3 1 8 4 9 5 6 2 10
5 2 1 4 10 7 9 8 3 6
5 8 1 6 9 3 2 4 7 10
8 10 3 4 5 7 2 9 6 1
3 10 2 7 8 5 1 4 9 6
10 6 1 5 4 2 3 8 9 7
4 5 9 1 8 2 7 6 3 10
Binary file added src/abc303/B/main
Binary file not shown.
64 changes: 64 additions & 0 deletions src/abc303/B/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#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 inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;

int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m; cin>>n>>m;
vector<vector<int> > memo(n);
REP(i, n){
REP(j, n){
memo[i].push_back(1);
}
}
vector<vector<int> > 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;
}
17 changes: 17 additions & 0 deletions src/abc303/B/metadata.json
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions src/abc303/B/out_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions src/abc303/B/out_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions src/abc303/B/out_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
4 changes: 4 additions & 0 deletions src/abc303/C/in_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
4 2 3 1
RUDL
-1 -1
1 0
4 changes: 4 additions & 0 deletions src/abc303/C/in_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
5 2 1 5
LDRLD
0 0
-1 -1
Binary file added src/abc303/C/main
Binary file not shown.
60 changes: 60 additions & 0 deletions src/abc303/C/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#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 inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;

int n, m, h, k;
string s;
map<P, int> ma;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m>>h>>k;
cin>>s;
vector<int> 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;
}
17 changes: 17 additions & 0 deletions src/abc303/C/metadata.json
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions src/abc303/C/out_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Yes
1 change: 1 addition & 0 deletions src/abc303/C/out_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No
2 changes: 2 additions & 0 deletions src/abc303/D/in_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 3 3
AAaA
2 changes: 2 additions & 0 deletions src/abc303/D/in_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 1 100
aAaAaA
2 changes: 2 additions & 0 deletions src/abc303/D/in_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 2 4
aaAaAaaAAAAaAaaAaAAaaaAAAAA
Binary file added src/abc303/D/main
Binary file not shown.
68 changes: 68 additions & 0 deletions src/abc303/D/main.cpp
Original file line number Diff line number Diff line change
@@ -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 <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return true;
}
return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return true;
}
return false;
}

typedef pair<int, int> 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;
}
17 changes: 17 additions & 0 deletions src/abc303/D/metadata.json
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions src/abc303/D/out_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
1 change: 1 addition & 0 deletions src/abc303/D/out_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
1 change: 1 addition & 0 deletions src/abc303/D/out_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
40