Submission #918452

# Submission time Handle Problem Language Result Execution time Memory
918452 2024-01-29T20:53:02 Z vjudge1 Password (RMI18_password) C++17
80 / 100
347 ms 696 KB
#include <bits/stdc++.h>
using namespace std; 
int query(string str);
vector<int> a; 
bool comp(pair<int,int> x,pair<int,int> y){
	if(x.first==y.first){
		return x.second<y.second;
	}
	string s2="";
	for(int i=0;i<x.second;i++){
		s2+=char('a'+x.first); 
	}
	for(int i=0;i<a[y.first]-y.second+1;i++){
		s2+=char('a'+y.first);
	}
	return (query(s2)==(int)s2.size());
}
string guess(int n,int s){
	a.resize(s);
	string s1=""; 
	for(int i=0;i<s;i++){
		s1=""; 
		for(int j=0;j<n;j++){
			s1+=char('a'+i); 
		}
		a[i]=query(s1); 
	}
	vector<pair<int,int>> b;
	for(int i=0;i<s;i++){
		for(int j=0;j<a[i];j++){
			b.push_back(make_pair(i,j+1));
		}
	}
	sort(b.begin(),b.end(),comp); 
	s1="";
	for(int i=0;i<n;i++){
		s1+=char('a'+b[i].first);
	}
	return s1; 
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Guessed the password with 85 queries.
2 Correct 1 ms 344 KB Guessed the password with 145 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Guessed the password with 154 queries.
2 Correct 1 ms 432 KB Guessed the password with 288 queries.
3 Correct 0 ms 436 KB Guessed the password with 51 queries.
4 Correct 4 ms 436 KB Guessed the password with 592 queries.
# Verdict Execution time Memory Grader output
1 Correct 56 ms 440 KB Guessed the password with 9971 queries.
2 Correct 52 ms 436 KB Guessed the password with 12691 queries.
3 Correct 105 ms 444 KB Guessed the password with 17961 queries.
4 Correct 130 ms 440 KB Guessed the password with 22732 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Guessed the password with 85 queries.
2 Correct 1 ms 344 KB Guessed the password with 145 queries.
3 Correct 1 ms 344 KB Guessed the password with 154 queries.
4 Correct 1 ms 432 KB Guessed the password with 288 queries.
5 Correct 0 ms 436 KB Guessed the password with 51 queries.
6 Correct 4 ms 436 KB Guessed the password with 592 queries.
7 Correct 56 ms 440 KB Guessed the password with 9971 queries.
8 Correct 52 ms 436 KB Guessed the password with 12691 queries.
9 Correct 105 ms 444 KB Guessed the password with 17961 queries.
10 Correct 130 ms 440 KB Guessed the password with 22732 queries.
11 Correct 191 ms 472 KB Guessed the password with 34846 queries.
12 Correct 174 ms 696 KB Guessed the password with 35552 queries.
13 Correct 187 ms 476 KB Guessed the password with 38971 queries.
14 Correct 184 ms 480 KB Guessed the password with 37338 queries.
15 Correct 232 ms 476 KB Guessed the password with 41753 queries.
16 Correct 221 ms 476 KB Guessed the password with 42057 queries.
17 Correct 239 ms 480 KB Guessed the password with 40813 queries.
18 Correct 214 ms 476 KB Guessed the password with 38821 queries.
19 Correct 208 ms 500 KB Guessed the password with 41871 queries.
20 Correct 215 ms 696 KB Guessed the password with 44098 queries.
21 Correct 205 ms 648 KB Guessed the password with 34574 queries.
22 Correct 166 ms 480 KB Guessed the password with 32233 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Guessed the password with 85 queries.
2 Correct 1 ms 344 KB Guessed the password with 145 queries.
3 Correct 1 ms 344 KB Guessed the password with 154 queries.
4 Correct 1 ms 432 KB Guessed the password with 288 queries.
5 Correct 0 ms 436 KB Guessed the password with 51 queries.
6 Correct 4 ms 436 KB Guessed the password with 592 queries.
7 Correct 56 ms 440 KB Guessed the password with 9971 queries.
8 Correct 52 ms 436 KB Guessed the password with 12691 queries.
9 Correct 105 ms 444 KB Guessed the password with 17961 queries.
10 Correct 130 ms 440 KB Guessed the password with 22732 queries.
11 Correct 191 ms 472 KB Guessed the password with 34846 queries.
12 Correct 174 ms 696 KB Guessed the password with 35552 queries.
13 Correct 187 ms 476 KB Guessed the password with 38971 queries.
14 Correct 184 ms 480 KB Guessed the password with 37338 queries.
15 Correct 232 ms 476 KB Guessed the password with 41753 queries.
16 Correct 221 ms 476 KB Guessed the password with 42057 queries.
17 Correct 239 ms 480 KB Guessed the password with 40813 queries.
18 Correct 214 ms 476 KB Guessed the password with 38821 queries.
19 Correct 208 ms 500 KB Guessed the password with 41871 queries.
20 Correct 215 ms 696 KB Guessed the password with 44098 queries.
21 Correct 205 ms 648 KB Guessed the password with 34574 queries.
22 Correct 166 ms 480 KB Guessed the password with 32233 queries.
23 Incorrect 347 ms 456 KB Could not guess the password with 50000 queries.
24 Halted 0 ms 0 KB -