# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117347 | 2024-11-23T10:52:45 Z | Unconcurrent | Password (RMI18_password) | C++14 | 7 ms | 440 KB |
// (C) Sologub Radu #include <iostream> #include <cmath> #include <vector> #include <fstream> #include <algorithm> #include <iomanip> // for std::setw and std::setfill #include <map> using namespace std; int query( string str) ; string guess(int len, int alphabet){ string guess = "a"; // first char guess while(query(guess) != 1){ guess[0]++; } forward_looking: // forward looking char forwardGuess = 'a'; while(query(guess + forwardGuess) < guess.size() + 1 && forwardGuess < 'a' + alphabet){ forwardGuess++; } if(forwardGuess >= 'a' + alphabet){ // failed forward look, skip; }else{ // success guess = guess + forwardGuess; // cout << guess << endl; goto forward_looking; } int backInsertIndex = guess.size() - 1; back_inserter: if(guess.size() == len){ return guess; } string backGuess = "a"; backGuess[0]--; string guessTry; do{ guessTry = guess; backGuess[0]++; guessTry.insert(backInsertIndex, backGuess); // cout << "guessTry = " << guessTry << endl; }while(backGuess[0] < 'a' + alphabet && query(guessTry) < guess.size() + 1); if(backGuess[0] >= 'a' + alphabet){ // failed back insert at index; backInsertIndex --; if(backInsertIndex < 0){ backInsertIndex = guess.size() - 1; } }else{ // success // backInsertIndex --; guess = guess.insert(backInsertIndex, backGuess); // cout << guess << endl; } goto back_inserter; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 440 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |