HDU 1816, POJ 2723 Get Luffy Out(2
HDU 1816, POJ 2723 Get Luffy Out 题目链接 题意:N串钥匙,每串2把,只能选一把,然后有n个大门,每个门有两个锁,开了一个就能通过,问选一些钥匙,最多能通过多少个门 思路:二分通过个数,然后对于钥匙建边至少一个不选,门建边至少一个选,然后2-sat
HDU 1816, POJ 2723 Get Luffy Out
题目链接
题意:N串钥匙,每串2把,只能选一把,然后有n个大门,每个门有两个锁,开了一个就能通过,问选一些钥匙,最多能通过多少个门
思路:二分通过个数,然后对于钥匙建边至少一个不选,门建边至少一个选,然后2-sat搞一下即可。
一开始是按每串钥匙为1个结点,可是后面发现数据有可能一把钥匙,出现在不同串(真是不合理),所以这个做法就跪了
代码:
#include <cstdio> #include <cstring> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; const int MAXNODE = 2105; struct TwoSet { int n; vector<int> g[MAXNODE * 2]; bool mark[MAXNODE * 2]; int S[MAXNODE * 2], sn; void init(int tot) { n = tot * 2; for (int i = 0; i <br> <br> </int></algorithm></vector></cstdlib></cstring></cstdio>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

If you are an IT administrator or technology expert, you must be aware of the importance of automation. Especially for Windows users, Microsoft PowerShell is one of the best automation tools. Microsoft offers a variety of tools for your automation needs, without the need to install third-party applications. This guide will detail how to leverage PowerShell to automate tasks. What is a PowerShell script? If you have experience using PowerShell, you may have used commands to configure your operating system. A script is a collection of these commands in a .ps1 file. .ps1 files contain scripts executed by PowerShell, such as basic Get-Help

1. Java calls post interface 1. Use URLConnection or HttpURLConnection that comes with java. There is no need to download other jar packages. Call URLConnection. If the interface response code is modified by the server, the return message cannot be received. It can only be received when the response code is correct. to return publicstaticStringsendPost(Stringurl,Stringparam){OutputStreamWriterout=null;BufferedReaderin=null;StringBuilderresult=newSt

In Linux, URL or Curl client is a popular command line utility that allows you to transfer data over the network using various protocols such as HTTPS, HTTP, FTP, etc. It allows you to send and receive data using its get, post and request methods. Among them, you need to use the "get" method frequently. Therefore, it becomes crucial to learn various methods and various options that you can use to increase your productivity. "Performing a curl operation is as simple as entering a few simple commands. Although it seems simple, many users do not fully realize its potential. Therefore, this short guide provides some information on how to perform curl operations on Linux systems. Example using the "curlget" command." Curl

Manually modify Ubuntu's apt-get source 1. Use the ssh tool to connect to Ubuntu (I use xshell) 2. Type cd/etc/apt/3 on the command line and back up the source.list file in this directory (you must have sudo permissions) ), then there is a source.list.bak file. 4. Clear the source.list file content (note: it cannot be restored after clearing, so you need to perform the previous step to back up the file in advance). At this time, use sudo to prompt that the permissions are insufficient. Switch directly to the root user and execute this command. 5. Use vim to open source.list, press the i key to enter the editing mode, paste the source address to be modified, and then press

1. The first method of the Controller layer receiving parameters without any annotations is the simplest. I seriously doubt why it was not used before. Who knows. . But this time it really worked. The simplest way is to add the Controller interface without adding any annotations! ! ! SpringBoot handles this automatically. The code is as follows: /***@authorzhangzhixiang*@sincev1.0.0*/@RestController@RequestMapping(path="/ui/institution")publicclassInstitutionManagemen

Get and post are two commonly used ajax request methods in jQuery, which are used to send requests to the server and obtain data. They have some differences in usage and some features. Next we will explain their similarities and differences in detail, and attach specific code examples. The similarities between get and post: they are both methods for sending ajax requests. You can obtain data from the server by specifying the URL and data parameters. Both can accept callback functions as parameters, which are used to process data returned by the server or handle failed requests.

Title: Comparison of usage scenarios of get and post in jQuery jQuery is a popular JavaScript library that provides rich features to simplify web development. Among them, commonly used Ajax methods include get and post, which are used to send requests to the server without refreshing the entire page. This article will focus on comparing the usage scenarios of get and post methods, and provide specific code examples. 1. Usage scenarios and examples of the get method: Obtaining data: The get method is suitable for use from the server

The main differences between get and post are usage methods, data transmission methods, request length limits, security, caching and idempotence, etc. Detailed introduction: 1. Usage method. The main difference between GET and POST is the usage method. The GET request is used to obtain data from the server. It is generally used to obtain resources or query data. It appends the request parameters to the back of the URL in key-value pairs. The POST request is passed to the server in the form of a POST request. It is used to submit data to the server. It is generally used to create, update or delete resources. It puts the request parameters in the request body and so on.
