# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
464088 | 2021-08-12T11:08:39 Z | Mamedov | Password (RMI18_password) | C++17 | 519 ms | 540 KB |
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define ll long long #define ui unsigned int #define pii pair<int, int> #define piii pair<int, pii> #define pb push_back #define f first #define s second #define oo (1ll << 60) using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int query(string str); string guess(int n, int s) { string str; vector<int>countLetter(s); int maxLetter = 0; for(int i = 0; i < s; ++i) { str = ""; for(int j = 0; j < n; ++j) { str += ('a' + i); } countLetter[i] = query(str); if(countLetter[i] > countLetter[maxLetter]) { maxLetter = i; } } vector<int>pos; str = ""; for(int i = 0; i < countLetter[maxLetter]; ++i) { str += ('a' + maxLetter); pos.pb(i); } pos.pb(str.length()); for(int i = 0; i < s; ++i) { if(i == maxLetter) continue; for(int j = 0; j < countLetter[i]; ++j) { shuffle(pos.begin(), pos.end(), rng); for(int k = 0; k <= str.length(); ++k) { str.insert(str.begin() + pos[k], 'a' + i); if(query(str) == str.length()) { pos.pb(str.length()); break; } str.erase(str.begin() + pos[k]); } } } return str; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 200 KB | Guessed the password with 93 queries. |
2 | Correct | 3 ms | 200 KB | Guessed the password with 189 queries. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Guessed the password with 97 queries. |
2 | Correct | 5 ms | 200 KB | Guessed the password with 238 queries. |
3 | Correct | 3 ms | 200 KB | Guessed the password with 162 queries. |
4 | Correct | 5 ms | 200 KB | Guessed the password with 451 queries. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 151 ms | 540 KB | Guessed the password with 18367 queries. |
2 | Correct | 519 ms | 432 KB | Guessed the password with 45971 queries. |
3 | Correct | 315 ms | 424 KB | Guessed the password with 41814 queries. |
4 | Incorrect | 473 ms | 324 KB | Could not guess the password with 50000 queries. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 200 KB | Guessed the password with 93 queries. |
2 | Correct | 3 ms | 200 KB | Guessed the password with 189 queries. |
3 | Correct | 1 ms | 200 KB | Guessed the password with 97 queries. |
4 | Correct | 5 ms | 200 KB | Guessed the password with 238 queries. |
5 | Correct | 3 ms | 200 KB | Guessed the password with 162 queries. |
6 | Correct | 5 ms | 200 KB | Guessed the password with 451 queries. |
7 | Correct | 151 ms | 540 KB | Guessed the password with 18367 queries. |
8 | Correct | 519 ms | 432 KB | Guessed the password with 45971 queries. |
9 | Correct | 315 ms | 424 KB | Guessed the password with 41814 queries. |
10 | Incorrect | 473 ms | 324 KB | Could not guess the password with 50000 queries. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 200 KB | Guessed the password with 93 queries. |
2 | Correct | 3 ms | 200 KB | Guessed the password with 189 queries. |
3 | Correct | 1 ms | 200 KB | Guessed the password with 97 queries. |
4 | Correct | 5 ms | 200 KB | Guessed the password with 238 queries. |
5 | Correct | 3 ms | 200 KB | Guessed the password with 162 queries. |
6 | Correct | 5 ms | 200 KB | Guessed the password with 451 queries. |
7 | Correct | 151 ms | 540 KB | Guessed the password with 18367 queries. |
8 | Correct | 519 ms | 432 KB | Guessed the password with 45971 queries. |
9 | Correct | 315 ms | 424 KB | Guessed the password with 41814 queries. |
10 | Incorrect | 473 ms | 324 KB | Could not guess the password with 50000 queries. |