제출 #251365

#제출 시각아이디문제언어결과실행 시간메모리
251365jamielimPassword (RMI18_password)C++14
0 / 100
3 ms256 KiB
// Sample grader for contestants' use. // // Usage: place your input data in the file password.in in the format // // line 1: N S // line 2: hidden_password // // Then compile this grader together with your implementation. // Run the binary to see your guessing strategy at work! // Set DEBUG to 1 to print all queries. #include <bits/stdc++.h> using namespace std; int query(string q); #define fi first #define se second #define pb push_back #define mp make_pair string join(string a,string b){ int la=a.length(),lb=b.length(); string q=b+a; string ans; int done=0; for(int i=0;i<=la;i++){ int ret=query(q); int newb=ret-la-done; int sz=(int)ans.size(); for(int j=done;j<done+newb;j++){ ans.pb(b[j]); } ans.pb(a[i]); q=ans; for(int j=done+newb;j<lb;j++)q.pb(b[j]); for(int j=i+1;j<la;j++)q.pb(a[j]); done+=newb; } return ans; } string guess(int n, int s){ priority_queue<pair<int,string>,vector<pair<int,string> >,greater<pair<int,string> > > pq; int occ[26]; for(int i=0;i<s;i++){ string q=""; for(int j=0;j<n;j++)q.pb(i+'a'); occ[i]=query(q); q=""; for(int j=0;j<occ[i];j++)q.pb(i+'a'); if(occ[i]>0)pq.push(mp(occ[i],q)); } while((int)pq.size()>1){ pair<int,string> cur1=pq.top();pq.pop(); pair<int,string> cur2=pq.top();pq.pop(); pq.push(mp(cur1.fi+cur2.fi,join(cur1.se,cur2.se))); } return pq.top().se; }

컴파일 시 표준 에러 (stderr) 메시지

password.cpp: In function 'std::__cxx11::string join(std::__cxx11::string, std::__cxx11::string)':
password.cpp:27:7: warning: unused variable 'sz' [-Wunused-variable]
   int sz=(int)ans.size();
       ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...