답안 #464399

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464399 2021-08-13T06:46:28 Z fuad27 Password (RMI18_password) C++14
0 / 100
133 ms 288 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vii vector<pair<int, int>>
#define vi vector<int>
#define vl vector<long long>
#define vll vector<pair<long long, long long>>
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = a;i<=b;i++)
#define f first
#define s second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
#define start int tt;cin>>tt;rep(testcase, 1, tt)
#define print(k) cout<<"Case #"<<testcase<<": "<<k<<"\n";
#define endl "\n"
int query(string s);
string guess(int n, int s) {
	string ans = "";
	int pref = 0;
	bool check = false;
	rep(tt, 0, n) {
		rep(i, 0, ans.size()) {
			ans.insert(i, "a");
			for(char c = 'a';c<'a' + s;c++) {
				ans[i] = c;
				int g = query(ans);
				if(g > pref){
					check = true;
					pref = g;
					break;
				}
			}
			if(!check) {
				ans = ans.substr(0, i) + ans.substr(i+1, n);
			}
		}
	}
	return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:11:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define rep(i, a, b) for(int i = a;i<=b;i++)
......
   24 |   rep(i, 0, ans.size()) {
      |       ~~~~~~~~~~~~~~~~               
password.cpp:24:3: note: in expansion of macro 'rep'
   24 |   rep(i, 0, ans.size()) {
      |   ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 133 ms 288 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -