Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <sstream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cassert>
#include <ctime>
#include <map>
#include <math.h>
#include <cstdio>
#include <set>
#include <deque>
#include <memory.h>
#include <queue>
#pragma comment(linker, "/STA... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<cstdio>
#include<cstring>
const int M=500009,INF=100000000;
int n,i,j,q,l,r,a[M],f[M][20],dp[M][30];
char s[M];
int read()
{
int x=0; char ch=getchar();
while (ch<48 || ch>57) ch=getchar();
while (ch>=48 && ch<=57) x=(x<<1)+(x<<3)+ch-48,ch=getchar();
return x;
}
int main()
{
scanf("%s",s+1),n=strlen(s+1... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int N=500010;
const int K=25;
int dp[N][26];
int fa[N][21];
int a[N];char s[N];
int main(){
//freopen("a.in","r",stdin);
//freopen("a.out","w",stdout);
int i,j,x,n,last,l,r,Q;
scanf("%s",s+1);n=str... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n)... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
char str[500000];
int f[27][500002],g[19][500002],n,q;
int main()
{
scanf("%s%d",str,&q),n=strlen(str);
for(int i=0;i<27;++i)f[i][n+1]=f[i][n]=n+1;
g[0][n+1]=g[0][n]=n+1;
for(int i=n-1;i>=0;--i)
{
f[str[i]-='a'][i]=i+1;
for(int j=str[i]+1;j<27;++j)
... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define SIZE 500005
#define ALP 27
#define BT 22
using namespace std;
int to[SIZE][BT];
int dp[SIZE][ALP];
int nxt[SIZE]... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <assert.h>
#define X fir... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
char s[500011];
int nxt[26][500011];
int nxt0[500011];
int nxt2[21][500011];
int n;
int q;
int main()
{
int i,j,k;
int l,r;
scanf("%s",s);
n=strlen(s);
scanf("%d",&q);
... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a)... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
const int N = 500010;
const int LOG = 21;
const int ALPHA = 28;
int pr[N][LOG];
int f[N][ALPHA];
int a[N];
char foo[N];
int main() {
scanf("%s", foo);
int len = strlen(foo);
for (int i = 0; i < len; i++) {
a[i] = foo[i] - 'a';
}
for (int c = 0; c <= 26; c+... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl
typedef long long ll;
typedef pair<int, int> point;
const int mod... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
#include <string>
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define mk make_... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#in... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define N 500500
#define rep(x, a, b) for(int x=a; x<=b; x++)
#define drp(x, a, b) for(int x=a; x>=b; x--)
int n, q, f[N][27], g[N][27];
char s[N];
int main(){
scanf("%s", s+1);
n=strlen(s+1);
drp(i, n, 1)
{
f[i][s[i]-'a']=i+1;
rep(j... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<cstdio>
#include<algorithm>
#define MN 600001
using namespace std;
int read_p,read_ca;
inline int read(){
read_p=0;read_ca=getchar();
while(read_ca<'0'||read_ca>'9') read_ca=getchar();
while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
return read_p;
}
char s[MN];... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stder... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | //#pragma GCC optimize(2)
//#include<bits/stdc++.h>
//using namespace std;
//stack <char> q;
//char a[1200000];
//inline int read() {
// int X=0,w=0;
// char ch=0;
// while(!isdigit(ch)) {
// w|=ch=='-';
// ch=getchar();
// }
// while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
// return w?-X:X;
//}
//int main... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back
// 看了题解,发现当时想不出的原因主要不是倍长,而是倍长的前一步的DP没想清楚
const int mxn = 500006;
const int emp = 26;
char a[mxn];
int n;
int f[mxn][27]; // 无效均为0
int s[mxn][20];
int main() {
scanf("%s", a + 1);
n... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,a[N],f[N][26],g[N][19]; char s[N];
int main(){
scanf("%s",s+1); n=strlen(s+1);
int i,j;
for (i=1; i<=n; i++) a[i]=s[i]-'a';
for (i=0; i<=25; i++) f[n+1][i]=f[n+2][i]=n+2;
for (i=0; i<=18; i++) g[n+1][i]=g[n+2][i]=n+2;
for (i=n; i; i--){
f[i][a... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main()
{
static char s[500010];
scanf("%s",s);
int n=strlen(s);
static int T[500010][30],S[500010][30];
for(int i=0;i<=n;i++){
for(int c=0;c<=26;c++){
T[i][c]=-1;
}
}
for(int c=0;c<26;c++){
S[n][c]=-1;
}
for(int i=n-1;i>=0;i--){
... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#define N 500005
#define LL long long
#define oo (1<<30)
using namespace std;
int n,q,ans,f[27][N],F[20][N]; char st[N];
int main()
{
int i,j,l,r;
scanf("%s",st+1);
n = strlen(st+1);
for(i=1;i<=n;i++)
f[st[... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <vector>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <cstdio>
#include <utility>
#include <bitset>
#include <complex>
#include <stack>
#include <tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,l... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
#define mp(x, y) make_pair((x), (y))
typedef long long ll;
int n;
char s[500005];
int dp[500005][27];
int nnext[500005][21];
int main()
{
scanf("%s\n", s);
n=strlen(s);
for(int i=0; i<n; i++) s[i]-='a';
for(int i=0; i<n; i++) for(int j=0; j<27; j++) dp[i][j]=-1;
fo... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()
... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5, Sigma = 27, bzmax = 20;
int n, q;
char s[N];
int nxt[N][Sigma], bz[N][bzmax];
int main() {
scanf("%s", s + 1);
n = strlen(s + 1);
scanf("%d", &q);
fill(nxt[n + 1], nxt[n + 1] + Sigma, N);
fill(bz[n + 1], bz[n + 1] + bzmax, N);
for (int i = n... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
#define DEBUG(x) cout << #x << " = " << x << endl
#define pb push_back
using namespace std;
typedef long long ll;
const int MAXN = 500005;
int d[MAXN][27];
int b[MAXN][30];
int main()
{
//freopen("input.txt", "r", stdin);
string s;
cin >> s;
int sz = s.size();
for (int i... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define li long long
#define itn int
using namespace std;
inline int nxt(){
int n;
scanf("%d", &n);
return n;
}
template <typename T>
ostream& operator <<(ostream& ostr, const vector<T>& a) {
ostr << "(";
... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a)... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define maxN 500011
#define sigma 26
#define maxLog 21
int n, i, q, l, r;
char s[maxN];
int nxt[sigma][maxN];
int dad[m... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
using namespace std;
typedef pair<int, int> P;
string s;
int Q;
int l[100005], r[100005];
int rpos[500005][27];
int succ[500005][20];
bool calc(int l, int r)
{
int p = l;
for(int i = 19; i >= 0; i--){
if(succ[p][i] <= r) p ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string S;
int Q;
vector<vector<int> > cc;
int dp(int l, int a) {
if(l == S.size()) return 1e9;
int &ret = cc[l][a];
if(ret != -1) return ret;
if(S[l] - 'a' == a) return ret = l + 1;
if(S[l] - 'a' < a) {
if(dp(l, a - 1) == ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <cassert>
#include <bitset>
using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define rep_d... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base :: sync_with_stdio(false);
//ifstream cin("testC.in");
string a; cin >> a;
int n = a.size();
for(int i = 0; i < n; ++i)
a[i] -= 'a';
vector<vector<int>> nxt(n, vector<int> (27, n));
for(int i = n - 1; i >= 0;... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | //bcw0x1bd2 {{{
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define SZ(x) ((int)((x).size()))
#define ALL(x) begin(x),end(x)
#define REP(i,x) for (int i=0; i<(x); i++)
#de... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 500005;
int n, dp[27][MAXN];
int nxt[19][MAXN];
char str[MAXN];
int main(){
scanf("%s", str + 1);
n = strlen(str + 1);
for(int i=0; i<27; i++) dp[i][n+1] = -1;
for(int j=n; j; j--){
for(int i=0; i<2... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | //satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int dp[500001][27];
int nxt[21][500001];
int main() {
string s;
cin >> s;
for(auto &c : s) c -= 'a';
fill_n(*dp, 500001 * 27, INF);
for(int i = (int) s.size() - 1; i >= 0; i--) {
dp[i][s[i]] = i + 1;
for(int j = s[i] + 1; j <= ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#define md double
#define LL long long
using namespace std;
const int N=1e6;
int gi() {
int w=0;bool q=1;char c=getchar();
while ((c<'0'||c>'9') &&... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | /// c.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
int n;
#define MAX 500002
char buf[MAX];
string s;
int dp[MAX][27];
int can[MAX];
int lc[22][MAX];
bool search(int lef, int goal){
for (int i = 21; i >= 0; i--){
if (lc[i][lef] == -1)continue;
if (lc[i][lef]==goa... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 |
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i = 1 ; i <= n ; ++i)
char s[500005];
int nxt[500005][30] ;
int ST[500005][20] ;
int n;
void init () {
n = strlen(s+1);
for (int i = 0 ; i <= 'z' - 'a' ; ++i) nxt[n+1][i] = nxt[n+2][i] = n+1;
for (int i = 0 ; i < 20 ; ++i) ST[n+1][i] = ST[... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
#define FOR(i,n) for(lli i=0;i<(lli)(n);++i)
#define FORU(i,j,k) for(lli i=(j);i<=(lli)(k);++i)
#define FORD(i,j,k) for(lli i=(j);i>=(lli)(k);--i)
#define pb push_back
#define mt make_tuple
using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using vi = vector<lli... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)1000000007
#define mod (int)1000000007
#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rtrep(i, n) for(int i = (n); i >= 0;... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
const int N = 500010;
const int LOG = 21;
int pr[N][21], f[N][28], a[N];
char ch[N];
inline int read()
{
int x = 0, f = 1; char ch = getchar();
while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <stdio.h>
char S[500500];
int C[500500][27],V[500500][19];
int main()
{
scanf ("%s",S+1);
int L = 0;
while (S[L+1]) L++;
for (int i=L;i>=1;i--){
int p = S[i]-'a';
C[i][p] = i+1;
for (int j=p+1;j<=26;j++) C[i][j] = C[C[i][j-1]][j-1];
V[i][0] = C[i][26];
if (V[i][0]) for (int j=0;j<p;j++) C[i][j]... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
using Matrix = vector<vector<T>>;
template <typename T>
Matrix<T> matrix(const int R, const int C, const T x = T()) { return Matrix<T>(R, vector<T>(C, x)); }
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s; cin >> s... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include "bits/stdc++.h"
using namespace std;
const int N = 5e5 + 5;
const int C = 27;
const int LN = 19;
int n;
char str[N];
int dp[N][C];
int nxt[N][C];
int q;
int l , r;
int arr[N];
int bin[LN][N];
int main(){
scanf("%s" , str + 1);
n = strlen(str + 1);
memset(dp , -1 , sizeof(dp));
memset(nxt , -1 ,... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<com... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#define N 1000005
#define LL long long
#define oo (1<<30)
using namespace std;
int n,q,ans,f[27][N],F[20][N]; char st[N];
int main()
{
int i,j,l,r;
scanf("%s",st+1);
n = strlen(st+1);
for(i=1;i<=n;i++)
f[st... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;
int mod(int a){
a = (a + 27) % 27;
return a;
}
void putmin(int &a, int b){
a = min(a, b);... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <stdio.h>
#include <iostream>
using namespace std;
const int maxn = 500000 + 10;
int f[maxn][27];
int step[maxn][27];
int main() {
int n;
string s;
cin >> s;
n = s.size();
for (int i = n + 1; i > -1; i--)
for (int j = 0; j < 26; j++) f[i][j] = n + 1;
for (int i = n - 1; i >... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
using Matrix = vector<vector<T>>;
int main()
{
string s; cin >> s;
const auto n = int(s.size());
auto f = Matrix<int>(n+2, vector<int>(27, n+1));
auto children = vector<vector<int>>(n+2);
children[n+1].push_back(n);
for (auto... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back
typedef pair<int, int> PII;
typedef long long LL;
const int MAXN=6e5;
char S... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef long doubl... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | // <string.cpp> - Sat Mar 25 20:06:07 2017
// This file is created by XuYike's black technology automatically.
// Copyright (C) 2015 ChangJun High School, Inc.
// I don't know what this program is.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
using na... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout);
using namespace std;
const int MAXN = 1000005;
int n, s[MAXN], Q;
int ne[MAXN][27], ST[MAXN][19];
void get_str() {
char ch = getchar();
while (ch < 'a' && ch > ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
#define X first
#define Y second
#define mp make_pair
using namespace std;
typedef pair<int,int> PII;
const int N = 500010;
char s[N];
int n,m,x,y,f[N][30],a[N];
bool ans[100010];
PII q[100010];
bool pd[N];
vector<int> v[N],Q[N];
void dfs(int x){
pd[x]=true;
int t;
for(int i=Q[x].size()-1;i... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <bitse... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define mp make_pair
#define pb push_back
/////////////////////////
int co... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#includ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
const int A = 26;
const int N = 500100;
const int LOG = 20;
int n;
char s[N];
int a[N][A];
int b[N][LOG];
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int dp[505050][27];
int nxt[20][505050];
int main()
{
string s;
cin >> s;
for (int i = 0; i < 27; i++)dp[s.size()][i] = dp[s.size() + 1][i] = s.size() + 1;
for (int i = s.size() - 1; i >= 0; i--)
{
dp[... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
void chmin(int& a, int b){
a = min(a, b);
}
int main(){
string S;
cin >> S;
int N = S.size();
vector<vector<int>> dp(N+2, vector<int>(27, N+1));
for(int i=0; i<N; i++) dp[i][S[i]-'a'] = i+1;
for(int i=N-1; i>=0; i--){
for(int j=0; ... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);+... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | #include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#d... | CPP |
p03793 Mujin Programming Challenge 2017 - Robot and String | You are developing a robot that processes strings. When the robot is given a string t consisting of lowercase English letters, it processes the string by following the procedure below:
1. Let i be the smallest index such that t_i = t_{i + 1}. If such an index does not exist, terminate the procedure.
2. If t_i is `z`, ... | 6 | 0 | import java.io.*;
import java.util.*;
public class Main {
FastScanner in;
PrintWriter out;
void solve() {
char[] s = in.next().toCharArray();
int n = s.length;
int[][] dp = new int[27][n];
final int MAX = 20;
int[][] go = new int[MAX][n];
for (int i = n - 1; i >= 0; i--) {
int cur = s[i] - 'a';
d... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int result = 0;
int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt();
if(a != b) result++;
if(a != c) result++;
if(b != c) result++;
if(a == b && b == c) result++;
System.out.... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.*;
class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
Set<Integer> hs = new HashSet<>();
hs.add(sc.nextInt());
hs.add(sc.nextInt());
hs.add(sc.nextInt());
System.out.println(hs.size());
}
}
| JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
Set s = new HashSet<Integer>();
... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | print(len(set(input().rstrip().split()))) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | c = list(set(map(int,input().split())))
print(len(c)) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashSet<Integer> hs = new HashSet<Integer>();
for (int i= 0;i<3;i++) {
hs.add(sc.nextInt());}
System.out.println(hs.size());
}
}
| JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | l = raw_input().split()
map_ = {}
for data in l:
map_[l[0]] = 1
map_[l[1]] = 1
map_[l[2]] = 1
print len(map_) | PYTHON |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c;
cin >> a >> b >> c;
set <int>d{a,b,c};
cout << d.size() ;
return 0;
} | CPP |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | print(len(set([int(_) for _ in input().split()]))) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.*;
class Main {
public static void main(String args[]) {
Scanner inp = new Scanner(System.in);
Set<Integer> s = new HashSet<Integer>();
for (int i = 0; i < 3; i++) {
s.add(inp.nextInt());
}
System.out.println(s.size());
}
} | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 |
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashMap<Integer, Integer> hmap = new HashMap<Integer, Integer>();
hmap.put(sc.nextInt(), 1);
hmap.put(sc.nextInt(), 1);
hmap.put(sc.nextInt(), 1);
Syst... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
set<int>s={a,b,c};
cout<<(int)s.size();
} | CPP |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import re
x = raw_input()
x = re.split(" ", x)
print len(set(x)) | PYTHON |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();
if(a == b && b == c){
System.out.println(1);
}
else if(a == b || a... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | li = set(map(int,input().split()))
print(len(li)) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | li=input().split()
Ans=list(set(li))
print(len(Ans)) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | S = set(input().split())
print(len(S))
| PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | #include <set>
#include <iostream>
using namespace std;
int x;
int main() {
set<int> s;
for(int i = 0; i < 3; i++) cin >> x, s.insert(x);
cout << s.size() << endl;
return 0;
} | CPP |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();int b=sc.nextInt();int c=sc.nextInt();
System.out.println((a==b)?(a==c)?1:2:(a==c)?2:(b==c)?2:3);
}
}
| JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
cout<<max(1,3-(a==b)-(b==c)-(a==c))<<endl;
return 0;
}
| CPP |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c,d=2;
cin >>a>>b>>c;
if(a==b&&b==c)d=1;
if(a!=b&&b!=c&&c!=a)d=3;
cout << d<< endl;
} | CPP |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int count = 1;
if (a != b) count++;
if (a != c && b != c) count++;
... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
Set<Integer> set = new HashSet<>();
set.add(a);
set.add(b);... | JAVA |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | print(len(list(set(list(input().split()))))) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | a = input().split()
print(len(list(set(a))))
| PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | A = set(map(int,input().split()))
print(len(A)) | PYTHON3 |
p03962 AtCoder Beginner Contest 046 - AtCoDeer and Paint Cans | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.
Since he is forgetful, he migh... | 6 | 0 | abc = input().split()
print(len(set(abc))) | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.