8000 solved 0x15 1620 · jo0n-lab/basic-algo-lecture@afa3713 · GitHub
[go: up one dir, main page]

Skip to content

Commit afa3713

Browse files
author
cuberry
committed
solved 0x15 1620
1 parent 69f008b commit afa3713

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed
File renamed without changes.

0x15/v1620/main

57.6 KB
Binary file not shown.

0x15/v1620/main.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int N, M;
5+
unordered_map<string, int> name2num;
6+
string num2name[100'002];
7+
8+
int main() {
9+
ios::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
cin >> N >> M;
13+
for (int i = 1; i <= N; i++) {
14+
cin >> num2name[i];
15+
name2num[num2name[i]] = i;
16+
}
17+
18+
for (int i = 1; i <= M; i++) {
19+
string input;
20+
cin >> input;
21+
int is_digit = int(input[0]) - int('0');
22+
if (is_digit >= 0 && is_digit <= 9) {
23+
int num = 0;
24+
for (int j = 0; j < input.length(); j++) {
25+
num *= 10;
26+
num += int(input[j]) - int('0');
27+
}
28+
cout << num2name[num];
29+
} else
30+
cout << name2num[input];
31+
cout << "\n";
32+
}
33+
}

0x15/v1620/tc1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
26 5
2+
Bulbasaur
3+
Ivysaur
4+
Venusaur
5+
Charmander
6+
Charmeleon
7+
Charizard
8+
Squirtle
9+
Wartortle
10+
Blastoise
11+
Caterpie
12+
Metapod
13+
Butterfree
14+
Weedle
15+
Kakuna
16+
Beedrill
17+
Pidgey
18+
Pidgeotto
19+
Pidgeot
20+
Rattata
21+
Raticate
22+
Spearow
23+
Fearow
24+
Ekans
25+
Arbok
26+
Pikachu
27+
Raichu
28+
25
29+
Raichu
30+
3
31+
Pidgey
32+
Kakuna

0 commit comments

Comments
 (0)
0