-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
Olympiad Practise/week last/.cph/.oly21practice47.cpp_0709a620a83c8c9c48b6090002d4f3c8.prob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"Local: oly21practice47","url":"c:\\My Files\\GitHub\\Practise\\Olympiad Practise\\week last\\oly21practice47.cpp","tests":[{"id":1623525100682,"input":"world\nword","output":"Yes"},{"id":1623525106799,"input":"snekee\nsnuke","output":"No"},{"id":1623525110835,"input":"hello\nhello","output":"Yes"}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\My Files\\GitHub\\Practise\\Olympiad Practise\\week last\\oly21practice47.cpp","group":"local","local":true} |
1 change: 1 addition & 0 deletions
1
Olympiad Practise/week last/.cph/.oly21practice55.cpp_4f1de5a06373a025e0334cea02715a4c.prob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"Local: oly21practice55","url":"c:\\My Files\\GitHub\\Practise\\Olympiad Practise\\week last\\oly21practice55.cpp","tests":[{"id":1623525803447,"input":"banana","output":"c"},{"id":1623525809009,"input":"abcdefghijklmnopqrstuvwxyz","output":"aa"},{"id":1623526010495,"input":"aabbccddeeffgghhiiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\My Files\\GitHub\\Practise\\Olympiad Practise\\week last\\oly21practice55.cpp","group":"local","local":true} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
typedef long long ll; | ||
typedef unsigned long long ull; | ||
typedef long double ld; | ||
typedef pair<int, int> pi; | ||
typedef pair<ll, int> pli; | ||
typedef pair<int, ll> pil; | ||
typedef pair<ll, ll> pl; | ||
typedef pair<ld, ld> pd; | ||
|
||
typedef vector<int> vi; | ||
typedef vector<ld> vd; | ||
typedef vector<ll> vl; | ||
typedef vector<pi> vpi; | ||
typedef vector<pl> vpl; | ||
|
||
#define INF 0x3f3f3f3f // for int | ||
#define LL_INF 0x3f3f3f3f3f3f3f3f // for ll | ||
#define sz(x) (int)(x).size() | ||
#define ms(x, y) memset(x, y, sizeof(x)) | ||
#define mp make_pair | ||
#define pb push_back | ||
#define f first | ||
#define s second | ||
#define lb lower_bound | ||
#define ub upper_bound | ||
#define all(x) x.begin(), x.end() | ||
#define ins insert | ||
|
||
const int MOD = 1000000007, MX = 100000 + 5; | ||
string A, B; | ||
int main() | ||
{ | ||
cin >> A >> B; | ||
if (!(A.size() == B.size() || A.size() - 1 == B.size())) | ||
{ | ||
printf("No\n"); | ||
return 0; | ||
} | ||
|
||
bool err = false; | ||
for (int i = 0; i < B.size(); i++) | ||
{ | ||
if (A.at(i + err) != B.at(i)) | ||
if (!err) | ||
err = true; | ||
else | ||
{ | ||
printf("No\n"); | ||
return 0; | ||
} | ||
} | ||
|
||
printf("Yes\n"); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
typedef long long ll; | ||
typedef unsigned long long ull; | ||
typedef long double ld; | ||
typedef pair<int, int> pi; | ||
typedef pair<ll, int> pli; | ||
typedef pair<int, ll> pil; | ||
typedef pair<ll, ll> pl; | ||
typedef pair<ld, ld> pd; | ||
|
||
typedef vector<int> vi; | ||
typedef vector<ld> vd; | ||
typedef vector<ll> vl; | ||
typedef vector<pi> vpi; | ||
typedef vector<pl> vpl; | ||
|
||
#define INF 0x3f3f3f3f // for int | ||
#define LL_INF 0x3f3f3f3f3f3f3f3f // for ll | ||
#define sz(x) (int)(x).size() | ||
#define ms(x, y) memset(x, y, sizeof(x)) | ||
#define mp make_pair | ||
#define pb push_back | ||
#define f first | ||
#define s second | ||
#define lb lower_bound | ||
#define ub upper_bound | ||
#define all(x) x.begin(), x.end() | ||
#define ins insert | ||
|
||
const int MOD = 1000000007, MX = 500 + 5; | ||
|
||
char str[MX]; | ||
vi revmap[256]; | ||
|
||
bool freq[256]; | ||
int freqc; | ||
|
||
int main() | ||
{ | ||
scanf("%s", str); | ||
int slen = strlen(str); | ||
for (int i = 0; i < slen; i++) | ||
{ | ||
char c = str[i]; | ||
revmap[c].push_back(i); | ||
} | ||
|
||
int len = 1; | ||
for (int c = 'a'; c <= 'z'; c++) | ||
{ | ||
if(revmap[c].empty()){ | ||
printf("%c\n", c); | ||
return 0; | ||
} | ||
} | ||
|
||
for (int c = 'a'; c <= 'z'; c++){ | ||
freqc = 0; | ||
for (int c2 = 'a'; c2 <= 'z'; c2++) | ||
freq[c2] = 0; | ||
|
||
for(int idx : revmap[c]){ | ||
if(idx == slen-1)continue; | ||
if(!freq[str[idx+1]]) | ||
freqc++; | ||
freq[str[idx+1]] = true; | ||
if(freqc==26)break; | ||
} | ||
if(freqc==26)continue; | ||
printf("%c", c); | ||
for (int c2 = 'a'; c2 <= 'z'; c2++) | ||
{ | ||
if(!freq[c2]){ | ||
printf("%c", c2); | ||
break; | ||
} | ||
} | ||
break; | ||
} | ||
|
||
printf("\n"); | ||
|
||
return 0; | ||
} |