Submission #3027298
Source Code Expand
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll>> pqls;
priority_queue <P,vector<P>,greater<P>> pqps;
//small priority queue
//top pop
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
ll rui(ll abc,ll bed){
//aのb乗を計算する
if(bed==0){return 1;}
else{
ll ced = rui(abc,bed/2);
ced *= ced;
ced %= mod;
if(bed%2==1){ced*=abc; ced%=mod;}
return ced;
}
}
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,d,e,f,g,h,w;
ll x[800005],y[800005],z[900005];
char s[500005];
int main(){
cin>>a>>s;
n = strlen(s);
for(i=0;i<n;i++){
x[i] = (s[i]-'a'+1);
}
while(true){
bool flag=false;
for(i=0;i<n-1;i++){
while(x[i]+a<=26 && x[i+1]>=1){
x[i] += a;
x[i+1]--;
flag = true;
}
}
if(!flag)break;
}
for(i=0;i<n;i++){
if(x[i]==0)continue;
cout<<(char)(x[i]+'a'-1);
}
el;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Best Password |
User |
enjapma |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
1815 Byte |
Status |
AC |
Exec Time |
3 ms |
Memory |
8576 KB |
Judge Result
Set Name |
All |
Score / Max Score |
100 / 100 |
Status |
|
Set Name |
Test Cases |
All |
corner_18, corner_19, corner_20, corner_21, corner_22, corner_23, large_09, large_10, large_11, large_12, large_13, large_14, large_15, large_16, large_17, sample_00, sample_01, sample_02, sample_03, small_00, small_01, small_02, small_03, small_04, small_05, small_06, small_07, small_08 |
Case Name |
Status |
Exec Time |
Memory |
corner_18 |
AC |
3 ms |
8576 KB |
corner_19 |
AC |
3 ms |
8576 KB |
corner_20 |
AC |
3 ms |
8576 KB |
corner_21 |
AC |
3 ms |
8576 KB |
corner_22 |
AC |
3 ms |
8576 KB |
corner_23 |
AC |
3 ms |
8576 KB |
large_09 |
AC |
3 ms |
8576 KB |
large_10 |
AC |
3 ms |
8576 KB |
large_11 |
AC |
3 ms |
8576 KB |
large_12 |
AC |
3 ms |
8576 KB |
large_13 |
AC |
3 ms |
8576 KB |
large_14 |
AC |
3 ms |
8576 KB |
large_15 |
AC |
3 ms |
8576 KB |
large_16 |
AC |
3 ms |
8576 KB |
large_17 |
AC |
3 ms |
8576 KB |
sample_00 |
AC |
3 ms |
8576 KB |
sample_01 |
AC |
3 ms |
8576 KB |
sample_02 |
AC |
3 ms |
8576 KB |
sample_03 |
AC |
3 ms |
8576 KB |
small_00 |
AC |
3 ms |
8576 KB |
small_01 |
AC |
3 ms |
8576 KB |
small_02 |
AC |
3 ms |
8576 KB |
small_03 |
AC |
3 ms |
8576 KB |
small_04 |
AC |
3 ms |
8576 KB |
small_05 |
AC |
3 ms |
8576 KB |
small_06 |
AC |
3 ms |
8576 KB |
small_07 |
AC |
3 ms |
8576 KB |
small_08 |
AC |
3 ms |
8576 KB |