結果
| 問題 | No.233 めぐるはめぐる (3) |
| コンテスト | |
| ユーザー |
nanasili
|
| 提出日時 | 2015-07-30 17:35:57 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,409 bytes |
| 記録 | |
| コンパイル時間 | 691 ms |
| コンパイル使用メモリ | 112,292 KB |
| 実行使用メモリ | 121,480 KB |
| 最終ジャッジ日時 | 2026-04-01 13:50:14 |
| 合計ジャッジ時間 | 3,804 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 4 |
ソースコード
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>
using namespace std;
typedef long long ll;
int main() {
int n;
scanf("%d", &n);
if (n >= 230400) {
puts("NO");
return 0;
}
int memo[12] = {4331, 16048, 21792, 22962, 24977, 2984, 24324, 6723, 1211, 29381, 29059, 9149};
set <int> hash;
for (int i = 0; i < n; i++) {
char s[12];
scanf("%s", s);
int t = 0;
for (int j = 0; j < 12; j++) {
t += s[j]*memo[j];
}
hash.insert(t);
}
int ind1[6], ind2[6];
for (int i = 0; i < 6; i++) {
ind1[i] = i;
ind2[i] = i;
}
char str[12] = "inabameguru";
do {
do {
int temp = 0;
for (int i = 0; i < 6; i++) {
temp += str[ind1[i]*2]*memo[i*2];
}
for (int i = 0; i < 5; i++) {
temp += str[2*ind2[i]+1]*memo[2*i+1];
}
if (hash.find(temp) == hash.end()) {
char ans[12];
for (int i = 0; i < 6; i++) {
ans[i*2] = str[ind1[i]*2];
}
for (int i = 0; i < 5; i++) {
ans[2*i+1] = str[2*ind2[i]+1];
}
ans[11] = '\0';
puts(ans);
return 0;
}
} while(next_permutation(ind2, ind2+5));
} while(next_permutation(ind1, ind1+6));
reverse(ind1, ind1+6);
reverse(ind2, ind2+5);
do {
do {
int temp = 0;
for (int p = 0; p <= 10; p+=2) {
for (int i = 1; i <= 10; i++) {
for (int j = 0; j <= 5; j++) {
if (2*j >= i) {
temp += str[2*ind1[j]+1]*memo[2*j+1];
}else {
temp += str[2*ind1[j]]*memo[2*j];
}
if (2*j+1 >= i) {
temp += str[2*ind2[j]+2]*memo[2*j+2];
}else {
temp += str[2*ind2[j]+1]*memo[2*j+1];
}
}
temp += str[p]*memo[i];
if (hash.find(temp) == hash.end()) {
char ans[12];
for (int j = 0; j <= 5; j++) {
if (2*j >= i) {
ans[2*j+1] = str[2*ind1[j]+1];
}else {
ans[2*j] = str[2*j];
}
if (2*j+1 >= i) {
ans[2*j+2] = str[2*j+2];
}else {
ans[2*j+1] = str[2*j+1];
}
}
ans[i] = str[p];
puts(ans);
return 0;
}
}
}
} while(next_permutation(ind2, ind2+5));
} while(next_permutation(ind1, ind1+5));
}
nanasili