# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
755872 | MohamedFaresNebili | Password (RMI18_password) | C++14 | 180 ms | 424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define DEBUG 0
#define MAX_QUERIES 50000
#define MAX_N 5000
#define MAX_SIGMA 26
static string password;
static int n, s, numQueries;
static stringstream msg;
int query(string str);
string guess(int n, int s) {
string S(n, 'a');
int freq[s], used[s]{0}; vector<int> p;
for(int l = 0; l < s; l++) {
for(int i = 0; i < n; i++)
S[i] = char(l + 'a');
freq[l] = query(S);
if(freq[l] > 0) p.push_back(l);
}
S = "";
for(int l = 0; l < n; l++) {
S.push_back('a');
for(int i = 0; i < s; i++) {
if(used[i] == freq[i]) continue;
S[l] = char(i + 'a');
if(l < n - 1) {
used[i]++; int cnt = 0, tr = 0;
for(int j = 0; j < s; j++) {
if(used[j] == freq[j]) continue;
if(cnt < tr) { tr++; continue; }
tr++;
for(int e = used[j] + 1; e <= freq[j]; e++)
S.push_back(char(j + 'a'));
int R = query(S); R -= l;
cnt += (R == 1 + freq[j] - used[j]);
for(int e = used[j] + 1; e <= freq[j]; e++)
S.pop_back();
}
used[i]--;
if(cnt == tr){
used[i]++;
break;
}
}
else {
int K = query(S);
if(K == n) break;
}
}
}
return S;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |