o3-mini· OpenAI
LMArena Human Preference 140K
简化小写变量名,不用注释,使用freopen,c++ [code]
- User
简化小写变量名,不用注释,使用freopen,c++
猜动物 题目描述 给出 N 个不同的动物以及每个动物的特征,猜动物的玩家只能够询问一个特征,裁判只能 回答是或不是,问猜出正确动物前最多能得到几个“是”的回答。 输入格式 以文件格式输入(文件名:guess.in) 输入的第一行包含动物的数量 N(2≤N≤100)。以下 N 行每行描述了一种动物。每一行开 始是这种动物的名称,接下来是一个整数 K(1≤K≤100),接下来是这种动物的 K 个特征。 动物的名称和特征是至多 20 个小写字母(a..z)组成的字符串。没有两种动物具有完全相 同的特征。 输出 以文件格式输出(文件名:guess.out) 输出游戏结束之前可能得到的“是”的回答的最大数量。 输入样例 4 bird 2 flies eatsworms cow 4 eatsgrass isawesome makesmilk goesmoo sheep 1 eatsgrass goat 2 makesmilk eatsgrass 输出样例 3 案例中的提问如下: "Does the animal fly?" "No" "Does the animal eat grass?" "Yes" "Does the animal make milk?" "Yes" "Does the animal go moo?" "Yes" "In that case I think the animal is a cow." "Correct!" 能得到 3 个“是” 提示 无 - Assistant
#include <iostream> #include <vector> #include <unordered_set> #include <algorithm> using namespace std; int main(){ freopen("guess.in", "r", stdin); freopen("guess.out", "w", stdout); int n; cin >> n; vector<unordered_set<string>> a(n); string s; for(int i = 0; i < n; i++){ cin >> s; int k; cin >> k; for(int j = 0; j < k; j++){ cin >> s; a[i].insert(s); } } int m = 0; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ int c = 0; for(auto &x : a[i]) if(a[j].count(x)) c++; m = max(m, c); } } cout << m + 1; return 0; }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.