搬完我做的题后发现我只做了 47 题……

6 comments

  • @ 2023-5-19 10:35:46

    dwsd

    • @ 2023-5-8 15:45:16
      // Standard iostream objects -*- C++ -*-
      
      // Copyright (C) 1997-2014 Free Software Foundation, Inc.
      //
      // This file is part of the GNU ISO C++ Library.  This library is free
      // software; you can redistribute it and/or modify it under the
      // terms of the GNU General Public License as published by the
      // Free Software Foundation; either version 3, or (at your option)
      // any later version.
      
      // This library is distributed in the hope that it will be useful,
      // but WITHOUT ANY WARRANTY; without even the implied warranty of
      // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      // GNU General Public License for more details.
      
      // Under Section 7 of GPL version 3, you are granted additional
      // permissions described in the GCC Runtime Library Exception, version
      // 3.1, as published by the Free Software Foundation.
      
      // You should have received a copy of the GNU General Public License and
      // a copy of the GCC Runtime Library Exception along with this program;
      // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      // <http://www.gnu.org/licenses/>.
      
      /** @file include/iostream
       *  This is a Standard C++ Library header.
       */
      
      //
      // ISO C++ 14882: 27.3  Standard iostream objects
      //
      
      #ifndef _GLIBCXX_IOSTREAM
      #define _GLIBCXX_IOSTREAM 1
      
      #pragma GCC system_header
      
      #include <bits/c++config.h>
      #include <ostream>
      #include <istream>
      
      namespace std _GLIBCXX_VISIBILITY(default)
      {
      _GLIBCXX_BEGIN_NAMESPACE_VERSION
      
        /**
         *  @name Standard Stream Objects
         *
         *  The &lt;iostream&gt; header declares the eight <em>standard stream
         *  objects</em>.  For other declarations, see
         *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html
         *  and the @link iosfwd I/O forward declarations @endlink
         *
         *  They are required by default to cooperate with the global C
         *  library's @c FILE streams, and to be available during program
         *  startup and termination. For more information, see the section of the
         *  manual linked to above.
        */
        //@{
        extern istream cin;		/// Linked to standard input
        extern ostream cout;		/// Linked to standard output
        extern ostream cerr;		/// Linked to standard error (unbuffered)
        extern ostream clog;		/// Linked to standard error (buffered)
      
      #ifdef _GLIBCXX_USE_WCHAR_T
        extern wistream wcin;		/// Linked to standard input
        extern wostream wcout;	/// Linked to standard output
        extern wostream wcerr;	/// Linked to standard error (unbuffered)
        extern wostream wclog;	/// Linked to standard error (buffered)
      #endif
        //@}
      
        // For construction of filebuffers for cout, cin, cerr, clog et. al.
        static ios_base::Init __ioinit;
      
      _GLIBCXX_END_NAMESPACE_VERSION
      } // namespace
      
      #endif /* _GLIBCXX_IOSTREAM */
      
      • @ 2023-5-6 15:06:09

        😕

        • @ 2023-5-6 11:25:02

          You are playing with a really long strip consisting of 101810^{18} white cells, numbered from left to right as 00, 11, 22 and so on. You are controlling a special pointer that is initially in cell 00. Also, you have a "Shift" button you can press and hold. In one move, you can do one of three actions: move the pointer to the right (from cell xx to cell x+1x + 1); press and hold the "Shift" button; release the "Shift" button: the moment you release "Shift", all cells that were visited while "Shift" was pressed are colored in black. (Of course, you can't press Shift if you already hold it. Similarly, you can't release Shift if you haven't pressed it.) Your goal is to color at least kk cells, but there is a restriction: you are given nn segments [li,ri][l_i, r_i] — you can color cells only inside these segments, i. e. you can color the cell xx if and only if lixril_i \le x \le r_i for some ii. What is the minimum number of moves you need to make in order to color at least kk cells black? The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases. The first line of each test case contains two integers nn and kk (1n21051 \le n \le 2 \cdot 10^5; 1k1091 \le k \le 10^9) — the number of segments and the desired number of black cells, respectively. The second line contains nn integers l1,l2,,lnl_1, l_2, \dots, l_n (1l1<l2<<ln1091 \le l_1 < l_2 < \dots < l_n \le 10^9), where lil_i is the left border of the ii-th segment. The third line contains nn integers r1,r2,,rnr_1, r_2, \dots, r_n (1ri1091 \le r_i \le 10^9; liri<li+11l_i \le r_i < l_{i + 1} - 1), where rir_i is the right border of the ii-th segment. Additional constraints on the input: every cell belongs to at most one segment; the sum of nn doesn't exceed 21052 \cdot 10^5. For each test case, print the minimum number of moves to color at least kk cells black, or 1-1 if it's impossible. Input The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases. The first line of each test case contains two integers nn and kk (1n21051 \le n \le 2 \cdot 10^5; 1k1091 \le k \le 10^9) — the number of segments and the desired number of black cells, respectively. The second line contains nn integers l1,l2,,lnl_1, l_2, \dots, l_n (1l1<l2<<ln1091 \le l_1 < l_2 < \dots < l_n \le 10^9), where lil_i is the left border of the ii-th segment. The third line contains nn integers r1,r2,,rnr_1, r_2, \dots, r_n (1ri1091 \le r_i \le 10^9; liri<li+11l_i \le r_i < l_{i + 1} - 1), where rir_i is the right border of the ii-th segment. Additional constraints on the input: every cell belongs to at most one segment; the sum of nn doesn't exceed 21052 \cdot 10^5. Output For each test case, print the minimum number of moves to color at least kk cells black, or 1-1 if it's impossible. 4 2 3 1 3 1 4 4 20 10 13 16 19 11 14 17 20 2 3 1 3 1 10 2 4 99 999999999 100 1000000000 8 -1 7 1000000004 Note In the first test case, one of the optimal sequences of operations is the following: Move right: pointer is moving into cell 11; Press Shift; Release Shift: cell 11 is colored black; Move right: pointer is moving into cell 22; Move right: pointer is moving into cell 33; Press Shift; Move right: pointer is moving into cell 44; Release Shift: cells 33 and 44 are colored in black. We've colored 33 cells in 88 moves. In the second test case, we can color at most 88 cells, while we need 2020 cell to color. In the third test case, one of the optimal sequences of operations is the following: Move right: pointer is moving into cell 11; Move right: pointer is moving into cell 22; Move right: pointer is moving into cell 33; Press Shift; Move right: pointer is moving into cell 44; Move right: pointer is moving into cell 55; Release Shift: cells 33, 44 and 55 are colored in black. We've colored 33 cells in 77 moves.

          • @ 2023-5-4 16:22:15

            An integer template is a string consisting of digits and/or question marks. A positive (strictly greater than 00) integer matches the integer template if it is possible to replace every question mark in the template with a digit in such a way that we get the decimal representation of that integer without any leading zeroes. For example: 4242 matches 4?; 13371337 matches ????; 13371337 matches 1?3?; 13371337 matches 1337; 33 does not match ??; 88 does not match ???8; 13371337 does not match 1?7. You are given an integer template consisting of at most 55 characters. Calculate the number of positive (strictly greater than 00) integers that match it. The first line contains one integer tt (1t21041 \le t \le 2 \cdot 10^4) — the number of test cases. Each test case consists of one line containing the string ss (1s51 \le |s| \le 5) consisting of digits and/or question marks — the integer template for the corresponding test case. For each test case, print one integer — the number of positive (strictly greater than 00) integers that match the template. Input The first line contains one integer tt (1t21041 \le t \le 2 \cdot 10^4) — the number of test cases. Each test case consists of one line containing the string ss (1s51 \le |s| \le 5) consisting of digits and/or question marks — the integer template for the corresponding test case. Output For each test case, print one integer — the number of positive (strictly greater than 00) integers that match the template. 8 ?? ? 0 9 03 1??7 ?5? 9??99 90 9 0 1 0 100 90 100

            • @ 2023-4-28 10:44:53

              6

              • 1