답안 #918449

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918449 2024-01-29T20:50:10 Z Huseyn123 Password (RMI18_password) C++17
80 / 100
276 ms 660 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; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Guessed the password with 85 queries.
2 Correct 1 ms 596 KB Guessed the password with 145 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Guessed the password with 154 queries.
2 Correct 1 ms 436 KB Guessed the password with 288 queries.
3 Correct 1 ms 436 KB Guessed the password with 51 queries.
4 Correct 3 ms 440 KB Guessed the password with 592 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 440 KB Guessed the password with 9971 queries.
2 Correct 63 ms 444 KB Guessed the password with 12691 queries.
3 Correct 103 ms 444 KB Guessed the password with 17961 queries.
4 Correct 117 ms 448 KB Guessed the password with 22732 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Guessed the password with 85 queries.
2 Correct 1 ms 596 KB Guessed the password with 145 queries.
3 Correct 1 ms 344 KB Guessed the password with 154 queries.
4 Correct 1 ms 436 KB Guessed the password with 288 queries.
5 Correct 1 ms 436 KB Guessed the password with 51 queries.
6 Correct 3 ms 440 KB Guessed the password with 592 queries.
7 Correct 67 ms 440 KB Guessed the password with 9971 queries.
8 Correct 63 ms 444 KB Guessed the password with 12691 queries.
9 Correct 103 ms 444 KB Guessed the password with 17961 queries.
10 Correct 117 ms 448 KB Guessed the password with 22732 queries.
11 Correct 195 ms 476 KB Guessed the password with 34846 queries.
12 Correct 234 ms 476 KB Guessed the password with 35552 queries.
13 Correct 239 ms 476 KB Guessed the password with 38971 queries.
14 Correct 212 ms 484 KB Guessed the password with 37338 queries.
15 Correct 263 ms 484 KB Guessed the password with 41753 queries.
16 Correct 238 ms 480 KB Guessed the password with 42057 queries.
17 Correct 210 ms 484 KB Guessed the password with 40813 queries.
18 Correct 216 ms 480 KB Guessed the password with 38821 queries.
19 Correct 232 ms 480 KB Guessed the password with 41871 queries.
20 Correct 249 ms 480 KB Guessed the password with 44098 queries.
21 Correct 195 ms 488 KB Guessed the password with 34574 queries.
22 Correct 161 ms 484 KB Guessed the password with 32233 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Guessed the password with 85 queries.
2 Correct 1 ms 596 KB Guessed the password with 145 queries.
3 Correct 1 ms 344 KB Guessed the password with 154 queries.
4 Correct 1 ms 436 KB Guessed the password with 288 queries.
5 Correct 1 ms 436 KB Guessed the password with 51 queries.
6 Correct 3 ms 440 KB Guessed the password with 592 queries.
7 Correct 67 ms 440 KB Guessed the password with 9971 queries.
8 Correct 63 ms 444 KB Guessed the password with 12691 queries.
9 Correct 103 ms 444 KB Guessed the password with 17961 queries.
10 Correct 117 ms 448 KB Guessed the password with 22732 queries.
11 Correct 195 ms 476 KB Guessed the password with 34846 queries.
12 Correct 234 ms 476 KB Guessed the password with 35552 queries.
13 Correct 239 ms 476 KB Guessed the password with 38971 queries.
14 Correct 212 ms 484 KB Guessed the password with 37338 queries.
15 Correct 263 ms 484 KB Guessed the password with 41753 queries.
16 Correct 238 ms 480 KB Guessed the password with 42057 queries.
17 Correct 210 ms 484 KB Guessed the password with 40813 queries.
18 Correct 216 ms 480 KB Guessed the password with 38821 queries.
19 Correct 232 ms 480 KB Guessed the password with 41871 queries.
20 Correct 249 ms 480 KB Guessed the password with 44098 queries.
21 Correct 195 ms 488 KB Guessed the password with 34574 queries.
22 Correct 161 ms 484 KB Guessed the password with 32233 queries.
23 Incorrect 276 ms 660 KB Could not guess the password with 50000 queries.
24 Halted 0 ms 0 KB -