結果
問題 | No.2925 2-Letter Shiritori |
ユーザー |
![]() |
提出日時 | 2024-11-24 05:05:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 60 ms / 2,000 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 3,265 ms |
コンパイル使用メモリ | 258,736 KB |
実行使用メモリ | 25,452 KB |
平均クエリ数 | 26.00 |
最終ジャッジ日時 | 2024-11-24 05:05:11 |
合計ジャッジ時間 | 4,444 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
ソースコード
//#include <monsterenergy>#include <bits/stdc++.h>using namespace std;typedef long long ll;#define all(x) (x).begin(), (x).end()#define rall(x) (x).rbegin(), (x).rend()const int MAX = 1e9;const int MIN = -1*1e9;const ll MAXLL = 1e18;const ll MINLL = -1*1e18;int main(){char C; cin >> C;set<pair<char,char>> Ans;vector<pair<int,char>> Count(200);for(int i = 0; i < 200; i++) Count[i] = {MAX,'?'};for(char i = 'a'; i <= 'z'; i++) Count[i] = {26,i};cout << "?" << " " << C << C << endl;Ans.insert({C,C});Count[C].first--;while(true){string S,S2; cin >> S2 >> S;if(S2 == "!") return 0;Ans.insert({S[0],S[1]});Count[S[0]].first--;sort(all(Count));for(int i = 0; i < 100; i++){char A = S[1];char B = Count[i].second;if(!Ans.count({A,B})){cout << "?" << " " << A << B << endl;}else continue;Count[A].first--;Ans.insert({A,B});break;}}return 0;}