<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="pageview">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base target="_top">
<style type="text/css">
/* default css */ table { font-size: 1em; line-height: inherit; } tr { text-align: left; } div, address, ol, ul, li, option, select { margin-top: 0px; margin-bottom: 0px; } p { margin: 0px; } body { margin: 6px; padding: 0px; font-family: Verdana, sans-serif; font-size: 10pt; background-color: #ffffff; } img { -moz-force-broken-image-icon: 1; } @media screen { html.pageview { background-color: #f3f3f3 !important; } body { min-height: 1100px; } * html body { height: 1100px; } .pageview body { border-top: 1px solid #ccc; border-left: 1px solid #ccc; border-right: 2px solid #bbb; border-bottom: 2px solid #bbb; width: 648px !important; margin: 15px auto 25px; padding: 40px 50px; } /* IE6 */ * html { overflow-y: scroll; } * html.pageview body { overflow-x: auto; } /* Prevent repaint errors when scrolling in Safari. This "Star-7" css hack targets Safari 3.1, but not WebKit nightlies and presumably Safari 4. That's OK because this bug is fixed in WebKit nightlies/Safari 4 :-). */ html*#wys_frame::before { content: '\A0'; position: fixed; overflow: hidden; width: 0; height: 0; top: 0; left: 0; } .writely-callout-data { display: none; *display: inline-block; *width: 0; *height: 0; *overflow: hidden; } .writely-footnote-marker { background-image: url('MISSING') target-counter(attr(href), page); } #WritelyTableOfContents a { text-decoration: none; color: black; } } @page { @top { content: flow(header); } @bottom { content: flow(footer); } @footnotes { border-top: solid black thin; padding-top: 8pt; } } /* end default print css */ /* custom css */ /* end custom css */ /* ui edited css */ body { font-family: Verdana; font-size: 10.0pt; line-height: normal; background-color: #ffffff; } /* end ui edited css */ /* editor CSS */ .editor a:visited {color: #551A8B} .editor table.zeroBorder {border: 1px dotted gray} .editor table.zeroBorder td {border: 1px dotted gray} .editor table.zeroBorder th {border: 1px dotted gray} .editor div.google_header, .editor div.google_footer { border: 2px #DDDDDD dashed; position: static; width: 100%; min-height: 2em; } .editor .misspell {background-color: yellow} .editor .writely-comment { font-size: 9pt; line-height: 1.4; padding: 1px; border: 1px dashed #C0C0C0 } /* end editor CSS */
</style>
</head>
<body onload="DoPageLoad();"
revision="dhgrm7w5_142fpffddcn:36">
<DIV>
<B>[08杭电网络赛.Another Easy Problem.模拟]</B>
</DIV>
<DIV>
<B></B>
</DIV>
<DIV>
<B>======================================================</B>
</DIV>
<DIV>
<B>终于AC了!</B>
</DIV>
<DIV>
<B>这题让我从比赛那天起一直郁闷到现在,WA了几十次了。不就是模拟吗?反复的读题,都倒背</B>
</DIV>
<DIV>
<B>如流了,昨晚又做,WA了又WA,百思不得其解,今早又做,再读题,终于发现了,原来,模</B>
</DIV>
<DIV>
<B>拟的过程有误,注意这句:</B>
</DIV>
<DIV>
<B></B>
</DIV>
<DIV>
<B>
<SPAN style="WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; WHITE-SPACE:normal; LETTER-SPACING:normal; BORDER-COLLAPSE:separate; TEXT-ALIGN:left"><FONT color=#ff0000>Process
courses, in the order they appear in the input.</FONT></SPAN></B>
</DIV>
<DIV>
<B><SPAN style="WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; WHITE-SPACE:normal; LETTER-SPACING:normal; BORDER-COLLAPSE:separate; TEXT-ALIGN:left"><FONT color=#ff0000></FONT></SPAN></B>
</DIV>
<DIV>
<SPAN style="WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; WHITE-SPACE:normal; LETTER-SPACING:normal; BORDER-COLLAPSE:separate; TEXT-ALIGN:left"><FONT color=#000000><B>意思就是按每门课程的输入次序处理请求,而我一直都是将请求按输入的次序处理的!恍然大悟</B></FONT></SPAN>
</DIV>
<DIV>
<SPAN style="WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; WHITE-SPACE:normal; LETTER-SPACING:normal; BORDER-COLLAPSE:separate; TEXT-ALIGN:left"><B>后,稍作改动就AC了。</B></SPAN>
</DIV>
<DIV>
<SPAN style="WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; WHITE-SPACE:normal; LETTER-SPACING:normal; BORDER-COLLAPSE:separate; TEXT-ALIGN:left"></SPAN>
</DIV>
<DIV>
<B>兴奋之余,有些遗憾和自责,不认真读题就急着coding是ACMer的大忌,一定要注意。。。</B>
</DIV>
<DIV>
</DIV>
<DIV>
<A href=http://acm.hdu.edu.cn/showproblem.php?pid=2418>http://acm.hdu.edu.cn/showproblem.php?pid=2418</A>
</DIV>
<DIV>
</DIV>
<DIV>
<A href=http://acm.hrbeu.edu.cn/index.php?act=problem&proid=7008>http://acm.hrbeu.edu.cn/index.php?act=problem&proid=7008</A>
</DIV>
<DIV>
</DIV>
<DIV>
<B>======================================================</B>
</DIV>
<DIV>
</DIV>
<DIV>
/*
</DIV>
<DIV>
Athor:mmlii
</DIV>
<DIV>
Source:<A href=http://acm.hdu.edu.cn/showproblem.php?pid=2418><FONT color=#800080>http://acm.hdu.edu.cn/showproblem.php?pid=2418</FONT></A>
</DIV>
<DIV>
*/
</DIV>
<DIV>
这是原来的思路,按请求读入的次序逐一处理:
</DIV>
<DIV>
<BR>
#include <iostream><BR>
#include <vector><BR>
using namespace std;
</DIV>
<DIV>
</DIV>
<DIV>
int nStu,nCor,nReq;
</DIV>
<DIV>
struct Stu{<BR>
char id[10010];<BR>
vector<int> reg;<BR>
};<BR>
struct Cor{<BR>
char id[10010];<BR>
int c;<BR>
vector<int> t;<BR>
};
</DIV>
<DIV>
</DIV>
<DIV>
int main(){<BR>
int i,j,k,r,t,p,res=0,z=1;<BR>
while(cin>>nStu>>nCor>>nReq){<BR>
vector<Stu> stu(nStu);<BR>
vector<Cor> cor(nCor);<BR>
cout<<stu.size()<<endl;<BR>
cout<<cor.size()<<endl;<BR>
for(i=0;i<nStu;i++)<BR>
cin>>stu[i].id;<BR>
for(i=0;i<nCor;i++){<BR>
cin>>cor[i].id>>cor[i].c>>t;<BR>
while(t--){<BR>
cin>>p;<BR>
cor[i].t.push_back(p);<BR>
}<BR>
}<BR>
res=0;<BR>
char st[10010],ct[10010];<BR>
for(i=0;i<nReq;i++){<BR>
cin>>st>>ct;<BR>
int u,v;<BR>
for(j=0;j<nCor;j++)<BR>
&nbs