結果
| 問題 | No.1694 ZerOne |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-02 00:16:07 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 702 bytes |
| 記録 | |
| コンパイル時間 | 1,089 ms |
| コンパイル使用メモリ | 172,708 KB |
| 実行使用メモリ | 1,430,672 KB |
| 最終ジャッジ日時 | 2026-03-06 18:11:43 |
| 合計ジャッジ時間 | 48,612 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 TLE * 8 MLE * 11 |
ソースコード
import std;
void main(){
auto S=readln.chomp;
auto L=S.length;
auto q=DList!(string)([S]);
bool[string] used;
used[S]=true;
auto result=1;
while(!q.empty){
auto s=q.front;
q.removeFront;
//stderr.writeln(s);
int[] zo;
int[] oz;
for(auto i=0;i<L-1;i++){
if(s[i]=='0'&&s[i+1]=='1'){
zo~=i;
}
if(s[i]=='1'&&s[i+1]=='0'){
oz~=i;
}
}
//stderr.writeln(zo);
//stderr.writeln(oz);
foreach(i;zo){
foreach(j;oz){
if((i-j).abs==1)continue;
char[] c=s.dup;
c[i]='1';
c[i+1]='0';
c[j]='0';
c[j+1]='1';
string cs=c.idup;
if(cs in used)continue;
q.insert(cs);
used[cs.idup]=true;
result++;
}
}
}
writeln(result);
}