どのように試験の別の偽明日を入れて、それは問題ではありません。
40/20/20
[3]クルト試験NOIP2013アナログベクトル(コード)(標準IO)
時間制限:
1000のミリ秒のメモリ制限: 131072キロバイトの詳細な制限
残り時間00:00:00
私はこの質問が失敗で書いていません。。。出席問題、ソートそれは二回取ることができます。
#include <ビット/ STDC ++ H> のtypedef 長い 長LL。 使用して 名前空間はstdを、 CONSTの INT N = 1E3 + 10 。 LL nを、B [N]、[N]。 ブールCMP(LLさt1、t2のLL){ 戻り T1> T2。 } int型のmain(){ scanf関数(" %のLLD "、&N) 以下のために(int型 i = 1 ; iが<= N; iが++ ){ scanf関数(" %のLLDを"&[I])。 } のための(INT I = 1; iが<= N; iは++ ){ scanf関数(" %のLLDを"、&B [I])。 } ソート(A + 1、A + N + 1 )。 ソート(B + 1、B + N + 1 、CMP)。 LL合計 = 0 ; 以下のために(int型 i = 1 ; iが<= N; iは++ ){ 合計 + = [I] * B [i]は、 } のprintf(" %のLLD " 、合計)。 リターン 0 ; }
3456 [3] NOIP2013アナログ試験恭介規則(ルール)(標準IO)
時間制限:
1000のミリ秒のメモリ制限: 131072キロバイトの詳細な制限
数学が得意ではない、トピックの数を扱うことができません。
具体的にプロセスを見て:
+高精度の圧力レベルの素因数分解。
しかし、私は押しビットをしません、高精度、ピットを離れる完成します。
3457. [3]さやNOIP2013試験シミュレーション人形(人形)(標準IO)
時間制限:
1000のミリ秒のメモリ制限: 131072キロバイトの詳細な制限
この質問はあまりにも厳しい、正解ネットワークフローた圧力DP、同様に考え始めている、最小パスカバレッジです。
でもエッジ:
1.も、古いから新しいに、1の状態遷移値、注意スプリットポイントに接続された各側。
2.ソースも古いポイント値エッジ1、シンクのエッジと1の偶数値に新しいポイントを取ることができるようにします。
3.これらも逆側、0の値を有します。
最大流量(二部グラフマッチングに)再度実行し、空のポイントを取るマイナスマッチの数は、最終的な答えです。
#include <bits/stdc++.h> using namespace std; const int N = 6e5+10,inf = 1e9; int n, m, S, T, ans, d[N],ed,head[N],px[5],py[5],maxflow,ma[60][60],r,c; int tot=-1; struct edge{ int w; int next; int to; }e[N]; inline void addedge(int x, int y, int z) { e[++tot].to=y; e[tot].next=head[x]; e[tot].w=z; head[x]=tot; }//建图 int pos(int x,int y){ return (x-1)*n+y; } inline bool bfs() { memset(d, 0, sizeof(d)); queue<int> q; q.push(S); d[S] = 1; while (q.size()) { int x = q.front(); q.pop(); for (int i = head[x]; i!=-1; i = e[i].next) { int y = e[i].to, z = e[i].w; if (d[y] || !z) continue; q.push(y); d[y] = d[x] + 1; if (y == T) return 1; } } return 0; } int dinic(int x, int flow) { if (x == T) return flow; int rest = flow; for (int i = head[x]; i!=-1 && rest; i = e[i].next) { int y = e[i].to, z = e[i].w; if (d[y] != d[x] + 1 || !z) continue; int k = dinic(y, min(rest, z)); if (!k) d[y] = 0; else { e[i].w -= k; e[i^1].w += k; rest -= k; } } return flow - rest; } void solve(){ int now=0; while(bfs()){ while(now=dinic(S,inf)) maxflow+=now; } printf("%d",ans-maxflow); } int main() { memset(head,-1,sizeof(head)); scanf("%d%d%d%d",&m,&n,&r,&c); char s[60]; S=0,T=m*n*2+1; for(int i=1;i<=m;i++){ scanf("%s",s); for(int j=1;j<=n;j++){ if(s[j-1]=='x') ma[i][j]=1; } } px[1]=r;px[2]=r;px[3]=c;px[4]=c; py[1]=c;py[2]=-c;py[3]=r;py[4]=-r; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ if(ma[i][j]) continue; addedge(S,pos(i,j),1); addedge(pos(i,j),S,0); addedge(pos(i,j)+n*m,T,1); addedge(T,pos(i,j)+m*n,0); ans++; for(int k=1;k<=4;k++){ int xx=i+px[k]; int yy=j+py[k]; if(xx>m||yy<=0||yy>n||ma[xx][yy]) continue; addedge(pos(i,j),pos(xx,yy)+m*n,1); addedge(pos(xx,yy)+m*n,pos(i,j),0); } } } solve(); return 0; }
(我不会告诉你我的二分图匹配是直接抄的)
总结:好好休息。