提出 #577226


ソースコード 拡げる

#include<bits/stdc++.h>
#include<sstream>

using namespace std;

#define reps(i,f,n) for(int i = f; i <= (n); ++i)
#define rep(i,n) reps(i,0,n-1)

#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define eb emplace_back



typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


int main(void){
  ios_base::sync_with_stdio(0);
	string x,z;
	string y = "0123456789";
	int n;
	ll ans = -1;
	string anss;
	ll xi, zi;
	ll tmp;
		stringstream ss;
		vector<ll> pwn(100);
		pwn[0]=1;
		rep(i,30) pwn[i+1]=pwn[i]*10;
	cin >> x;
	n = x.size();
	do{
		ss.clear();
		rep(i,n) ss << y[i];

		ss >> z;

		ss.clear();
		ss << z;ss >> zi;

		ss.clear();
		ss << x;ss >> xi;

		if( x == z)continue;
		tmp = min(abs(xi-zi), pwn[n]-abs(xi-zi));
		if(tmp > ans){
			ans = tmp;
			anss = z;
		}
	}while(next_permutation(all(y)));
	cout << anss << endl;
  return 0;
}

提出情報

提出日時
問題 B - Change a Password
ユーザ debug
言語 C++11 (GCC 4.8.1)
得点 100
コード長 947 Byte
結果 AC
実行時間 4989 ms
メモリ 132400 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 61
セット名 テストケース
All 00_test_00, 00_test_01, 00_test_02, 00_test_03, 01_rand_00, 01_rand_01, 01_rand_02, 01_rand_03, 01_rand_04, 01_rand_05, 01_rand_06, 01_rand_07, 01_rand_08, 01_rand_09, 01_rand_10, 01_rand_11, 01_rand_12, 01_rand_13, 01_rand_14, 01_rand_15, 01_rand_16, 01_rand_17, 01_rand_18, 01_rand_19, 01_rand_20, 01_rand_21, 01_rand_22, 01_rand_23, 01_rand_24, 01_rand_25, 01_rand_26, 01_rand_27, 01_rand_28, 01_rand_29, 01_rand_30, 01_rand_31, 01_rand_32, 01_rand_33, 01_rand_34, 01_rand_35, 01_rand_36, 01_rand_37, 01_rand_38, 01_rand_39, 01_rand_40, 01_rand_41, 01_rand_42, 01_rand_43, 01_rand_44, 01_rand_45, 01_rand_46, 01_rand_47, 01_rand_48, 01_rand_49, 99_handmake_00, 99_handmake_01, 99_handmake_02, 99_handmake_03, 99_handmake_04, 99_handmake_05, 99_handmake_06
ケース名 結果 実行時間 メモリ
00_test_00 AC 2490 ms 34000 KiB
00_test_01 AC 2491 ms 33968 KiB
00_test_02 AC 3018 ms 66772 KiB
00_test_03 AC 4258 ms 132292 KiB
01_rand_00 AC 4010 ms 132272 KiB
01_rand_01 AC 4210 ms 132396 KiB
01_rand_02 AC 4066 ms 132260 KiB
01_rand_03 AC 3417 ms 66744 KiB
01_rand_04 AC 3282 ms 66740 KiB
01_rand_05 AC 3294 ms 66788 KiB
01_rand_06 AC 3321 ms 66856 KiB
01_rand_07 AC 3674 ms 132272 KiB
01_rand_08 AC 4003 ms 132384 KiB
01_rand_09 AC 4340 ms 132308 KiB
01_rand_10 AC 2249 ms 34044 KiB
01_rand_11 AC 2239 ms 33972 KiB
01_rand_12 AC 3443 ms 66744 KiB
01_rand_13 AC 4096 ms 132276 KiB
01_rand_14 AC 2477 ms 33980 KiB
01_rand_15 AC 3663 ms 132288 KiB
01_rand_16 AC 2239 ms 33980 KiB
01_rand_17 AC 3903 ms 132328 KiB
01_rand_18 AC 2769 ms 66860 KiB
01_rand_19 AC 3289 ms 66744 KiB
01_rand_20 AC 2268 ms 33972 KiB
01_rand_21 AC 2776 ms 66852 KiB
01_rand_22 AC 4582 ms 132256 KiB
01_rand_23 AC 2773 ms 66740 KiB
01_rand_24 AC 2251 ms 33976 KiB
01_rand_25 AC 3902 ms 132272 KiB
01_rand_26 AC 4586 ms 132328 KiB
01_rand_27 AC 1745 ms 17588 KiB
01_rand_28 AC 3909 ms 132280 KiB
01_rand_29 AC 4543 ms 132276 KiB
01_rand_30 AC 3689 ms 132280 KiB
01_rand_31 AC 4414 ms 132276 KiB
01_rand_32 AC 3055 ms 66744 KiB
01_rand_33 AC 2512 ms 33976 KiB
01_rand_34 AC 4029 ms 132280 KiB
01_rand_35 AC 2480 ms 33976 KiB
01_rand_36 AC 3690 ms 132276 KiB
01_rand_37 AC 3025 ms 66736 KiB
01_rand_38 AC 2237 ms 33972 KiB
01_rand_39 AC 3687 ms 132280 KiB
01_rand_40 AC 4435 ms 132272 KiB
01_rand_41 AC 3670 ms 132344 KiB
01_rand_42 AC 2535 ms 33972 KiB
01_rand_43 AC 4403 ms 132276 KiB
01_rand_44 AC 3747 ms 132276 KiB
01_rand_45 AC 3027 ms 66740 KiB
01_rand_46 AC 3674 ms 132268 KiB
01_rand_47 AC 4102 ms 132400 KiB
01_rand_48 AC 2907 ms 66736 KiB
01_rand_49 AC 3015 ms 66736 KiB
99_handmake_00 AC 4663 ms 132272 KiB
99_handmake_01 AC 4989 ms 132276 KiB
99_handmake_02 AC 4589 ms 132312 KiB
99_handmake_03 AC 4549 ms 132280 KiB
99_handmake_04 AC 4583 ms 132280 KiB
99_handmake_05 AC 4588 ms 132396 KiB
99_handmake_06 AC 4543 ms 132280 KiB