結果
| 問題 | No.3418 【絶望】30個並列ごちゃ混ぜHit&Blowで遊ぼう! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-08 22:11:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 110 ms / 5,000 ms |
| コード長 | 1,167 bytes |
| 記録 | |
| コンパイル時間 | 3,628 ms |
| コンパイル使用メモリ | 291,888 KB |
| 実行使用メモリ | 26,228 KB |
| スコア | 9,992,441 |
| 平均クエリ数 | 75.59 |
| 最終ジャッジ日時 | 2025-12-25 01:29:41 |
| 合計ジャッジ時間 | 15,572 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
bool check(string s){
sort(s.begin(),s.end());
for(int i=1;i<s.size();i++){
if(s[i-1]==s[i]){return false;}
}
return true;
}
int hbc(string s,string t){
int res=0;
for(int k=0;k<5;k++){
if(s[k]==t[k]){res+=6;}
}
for(int k=0;k<5;k++){
for(int l=0;l<5;l++){
if(k==l){continue;}
if(s[k]==t[l]){res++;}
}
}
return res;
}
int main(){
vector<string> s;
for(int i=0;i<=99999;i++){
int v=i;
string cur;
for(int j=0;j<5;j++){
cur.push_back('0'+v%10);
v/=10;
}
reverse(cur.begin(),cur.end());
if(check(cur)){s.push_back(cur);}
}
vector<int> alive;
for(int i=0;i<s.size();i++){
alive.push_back(i);
}
while(true){
string q=s[alive.back()];
alive.pop_back();
cout << q << "\n";
fflush(stdout);
vector<int> fl(32,0);
vector<pair<int,int>> hb(30);
for(auto &nx : hb){
cin >> nx.first >> nx.second;
fl[nx.first*6+nx.second]=1;
}
if(hb[0].first==5){return 0;}
vector<int> und;
for(auto &nx : alive){
if(fl[hbc(q,s[nx])]){und.push_back(nx);}
}
alive=und;
}
}