shizaero

Untitled

Aug 23rd, 2023
1,198
0
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.19 KB | None | 0 0
  1. #include <algorithm>
  2. #include <cassert>
  3. #include <string>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. // Объявляем Sentence<Token> для произвольного типа Token
  9. // синонимом vector<Token>.
  10. // Благодаря этому в качестве возвращаемого значения
  11. // функции можно указать не малопонятный вектор векторов,
  12. // а вектор предложений — vector<Sentence<Token>>.
  13. template <typename Token>
  14. using Sentence = vector<Token>;
  15.  
  16. template <typename TokenForwardIt>
  17. TokenForwardIt FindSentenceEnd(TokenForwardIt tokens_begin, TokenForwardIt tokens_end) {
  18.     const TokenForwardIt before_sentence_end
  19.         = adjacent_find(tokens_begin, tokens_end, [](const auto& left_token, const auto& right_token) {
  20.         return left_token.IsEndSentencePunctuation() && !right_token.IsEndSentencePunctuation();
  21.             });
  22.     return before_sentence_end == tokens_end ? tokens_end : next(before_sentence_end);
  23. }
  24.  
  25. // Класс Token имеет метод bool IsEndSentencePunctuation() const
  26. template <typename Token>
  27. vector<Sentence<Token>> SplitIntoSentences(vector<Token> tokens) {
  28.     // Напишите реализацию функции, не копируя объекты типа Token
  29.     vector<Sentence<Token>> libr;
  30.  
  31.     //size_t tokens_size = tokens.size();
  32.     auto it_start = tokens.begin();
  33.  
  34.     while (it_start <= tokens.end()) {
  35.         Sentence<Token> sentence; //создаем предложение, которое будем заполнять
  36.  
  37.         //узнаем, на какой позиции находится наш знак препинания
  38.         auto it_sent_end = FindSentenceEnd(it_start, tokens.end());
  39.         auto dist_to_stop = distance(tokens.begin(), it_sent_end);
  40.  
  41.         //Резервируем память для кол-ва элементов до первого пунктуационного знака
  42.         sentence.reserve(dist_to_stop);
  43.  
  44.         //Заполняем предложение, перемещая из tokens
  45.         for (auto it = it_start; it <= it_sent_end; ++it) {
  46.             //*it = move(tokens.at(count++));
  47.             sentence.push_back(move(*it));
  48.         }
  49.         //Добавляем предложение в словарь
  50.         libr.push_back(move(sentence));
  51.  
  52.         //Удаляем предложение, чтобы потом создать его снова
  53.         //sentence.clear();
  54.         //delete sentence;
  55.         //it_start = tokens.at(++dist_to_stop);
  56.         advance(it_start, dist_to_stop++);
  57.     }
  58.  
  59.     return libr;
  60. }
  61.  
  62. struct TestToken {
  63.     string data;
  64.     bool is_end_sentence_punctuation = false;
  65.  
  66.     bool IsEndSentencePunctuation() const {
  67.         return is_end_sentence_punctuation;
  68.     }
  69.     bool operator==(const TestToken& other) const {
  70.         return data == other.data && is_end_sentence_punctuation == other.is_end_sentence_punctuation;
  71.     }
  72. };
  73.  
  74. ostream& operator<<(ostream& stream, const TestToken& token) {
  75.     return stream << token.data;
  76. }
  77.  
  78. // Тест содержит копирования объектов класса TestToken.
  79. // Для проверки отсутствия копирований в функции SplitIntoSentences
  80. // необходимо написать отдельный тест.
  81. void TestSplitting() {
  82.     assert(SplitIntoSentences(vector<TestToken>({ {"Split"s}, {"into"s}, {"sentences"s}, {"!"s} }))
  83.         == vector<Sentence<TestToken>>({ {{"Split"s}, {"into"s}, {"sentences"s}, {"!"s}} }));
  84.  
  85.     assert(SplitIntoSentences(vector<TestToken>({ {"Split"s}, {"into"s}, {"sentences"s}, {"!"s, true} }))
  86.         == vector<Sentence<TestToken>>({ {{"Split"s}, {"into"s}, {"sentences"s}, {"!"s, true}} }));
  87.  
  88.     assert(SplitIntoSentences(vector<TestToken>(
  89.         { {"Split"s}, {"into"s}, {"sentences"s}, {"!"s, true}, {"!"s, true}, {"Without"s}, {"copies"s}, {"."s, true} }))
  90.         == vector<Sentence<TestToken>>({
  91.             {{"Split"s}, {"into"s}, {"sentences"s}, {"!"s, true}, {"!"s, true}},
  92.             {{"Without"s}, {"copies"s}, {"."s, true}},
  93.             }));
  94. }
  95.  
  96. int main() {
  97.     TestSplitting();
  98. }
Advertisement
Comments
  • User was banned
  • User was banned
  • Vormilir
    208 days
    # CSS 0.85 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
  • User was banned
Add Comment
Please, Sign In to add comment