See a lot of people discuss the 4006 L3 issue, everyone wants to figure out the structure of the x4232-L3The WS-X4232-L3 is a routing module for Cisco Catalyst 4000 series switches and can only be used on a 4000 Switch that uses the Supervisor Engine 1 and 2, the module has 32 Fast Ethernet ports and two 1-gigabit Ethernet ports, and two 1-gigabit Ethernet ports are used as routing interfaces. The module ha
HDU 4006 PortalProblem DescriptionXiao Ming and Xiao Bao is playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao What's the kth great number is. Because the number written by Xiao Ming are too much, Xiao Bao is feeling giddy. Now, try-to-help Xiao Bao.InputThere is several test cases. For each test case, the first line of input contains the positive integer n, K. then n lines follow. If Xiao Ming Choos
HDU 4006 The kth great number AVL Solution
When dynamic data update is provided, what is the maximum K value in real time?
The AVL data structure is used for a relatively advanced data structure.
I don't know if the data value given by the question is repeated, because the program below can process repeated data.
The secret here is that the repeat information is added to know how many times the current array appears.
We mainly know how to maintain the
The kth great numberTime limit:2000/1000 MS (java/others) Memory limit:65768/65768 K (java/others)Total submission (s): 6982 Accepted Submission (s): 2837Problem Descriptionxiao Ming and Xiao Bao is playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao What's the kth great number is. Because the number written by Xiao Ming are too much, Xiao Bao is feeling giddy. Now, try-to-help Xiao Bao.Inputthere is several test cases. For each test case, the
The kth great numberTime limit:2000/1000 MS (java/others) Memory limit:65768/65768 K (java/others)Total submission (s): 8246 Accepted Submission (s): 3261Problem Descriptionxiao Ming and Xiao Bao is playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao What's the kth great number is. Because the number written by Xiao Ming are too much, Xiao Bao is feeling giddy. Now, try-to-help Xiao Bao.Inputthere is several test cases. For each test case, the f
/* Use STL set to maintain the set size as K */
Problem: 4006 (the kth great number) JudgeStatus: AcceptedRunid: 6313274 language: C ++ Author: cherrychouCode render status: rendered by hdoj C ++ code render version 0.01 Beta
#includeint n,k;char ch;using namespace std;int main(){ while(cin>>n>>k){ int x; multiset aa; while(n--){ cin>>ch; if(ch=='I'){ scanf("%d",x); aa.insert(x); if(aa.size()>k) aa.erase(aa.begin());}
://www.cnblogs.com/zgmf_x20a/archive/2008/11/15/1334109.html
It is used to calculate the decimal number of K. Obviously, when the total number of points is known, it can be used to obtain the large number of K.
But later I found that the first version was wrong,
Similar code
int ans=0;for(int i=1
I have been using this wa for a long time, and there are two errors: ① change to If (C [ans + I]
Code (for the combination of the two methods, see the Notes ):
// Hdoj-
The Kth great number
Xiao Ming and Xiao Bao are playing a simple numbers game. in a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. because the number written by Xiao Ming is too much, Xiao Bao is feeling giddy. now, try to help Xiao Bao.
Input
There are several test cases. for each test case, the first line of input contains two positive integer N, K. then n lines follow. if Xiao Ming choose to write down a number, there will be an "I" followed
Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 4006
Question:Given N operations, there are two types of operations: insert and query the k-th largest number. N
Solution: Because this question has not been deleted, it becomes very simple. You only need to maintain a small top heap with a size of K.
However, if there is a delete operation, it becomes more complicated. So I wrote this question using SBT, and I wrote it twice in anger.
Simple and naked priority queue question!
The children were stunned. I made a mistake several times !!!
The question requires that the number k be output. The value is always updated, so the common method will time out,
In this case, you can use a value to record the number of inputs. If the number is smaller than K, the number entered is firmly in the column,
Otherwise, the number entered is compared with the number of K in the column. If the number is greater than the number of K in the colum
Priority queue header file
# Include
The default priority is from large to small.
Custom priority
1 struct cmpmin{ //按从小到大 2 3 // 因为标准库默认使用元素类型的View code
This topic outputs the k-th largest number. Because the data volume is large and cannot be sorted each time, the priority queue is used to solve the problem.
1 #include
HDU 4006 the kth great number (priority queue)
n operations I is to insert a number q is the number of the output K largeSample Input8 3//n KI 1I 2I 3QI 5QI 4QSample Output1231# include 2# include 3# include 4# include 5# include string>6# include 7# include 8# include 9# define LLLong LongTen using namespacestd; One A structSS - { -FriendBOOL operatorConstSS A,ConstSS B) the { - if(a.v>B.V) - return 1; - Else + return 0; - } + intv; A }; at - intMain () - { - //freopen ("In.txt", "R"
Analysis: Can be done with line segment tree, but feel trouble. With a priority queue, the first K-large number is retained each time you insert.#include HDU ACM 4006 The kth great number segment tree? Priority queue?
Test instructions dynamic Query K-Large numberMaintain the K number in the first priority queue with decimals if this number is less than the first element of the team, then you do not have to insert the first element of the team. This number is queued for each query, only the first element of the output team.#include The kth great numberProblem Descriptionxiao Ming and Xiao Bao is playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao What's the k
); - } - Else A { +O->maintain (); the } - } $ } the } the the intKTH (Node * o,intk) the { - intTMP = (o->ch[0] = = NULL?0: o->ch[0]->size); in if(k >= tmp +1 k returnO->v; the Else if(K 1)returnKTH (o->ch[0], k); the Else returnKTH (o->ch[1], k-tmp-o->CNT); About } the the voidClear (Node *o) the { + if(o = = NULL)return ; -Clear (o->ch[0] ); theClear (o->ch[1] );Bayi Deleteo; the } the - intMain () - { the
I. CAT4006 engine module WS-X4013 configuration listThese include: Basic settings, VLAN configuration, Channel configuration, and port Image Port 1/2 to connect to gigabit IDS)
Cisco Systems, Inc. Console
Enter password:CAT4006> enable
Enter password:CAT4006> (enable).....................................................................................
Begin!# ***** NON-DEFAULT CONFIGURATION *****!!# Time: Mon Apr 11 2005, 22:02:13!# Version 6.1 (1)!!#
Basic information of the network
The network topology is: The central switch uses Cisco Catalyst 4006-s3,supervisor Engine III G engine in the 1th slot, for three-layer exchange, 1 24-Port 1000base-t module in the 2nd slot, for connecting to the network server; The 1 Block 6 Port 1000base-x module is located in the 3rd slot for connecting 6 backbone switches. One switch uses
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.